Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Old 02-27-2008, 10:34 AM ' in PHP/MySQL...
Novice Talker

Posts: 14
Location: UK
Trades: 0
Hi all,

trying to pull some data from my MySQL database, including a small paragraph of text that uses a few hyphens... Of course, when printing this I am left with strange characters where the hyphen should be. I've tried coding the addslashes function into my script, but that just produced a parser error...

My script is as follows:

PHP Code:
<?php 
// Collects data from "friends" table 
$data mysql_query("SELECT * FROM bio"
or die(
mysql_error());

while(
$info mysql_fetch_array$data )) 

Print 
"<div class='bio-image'><img src='images/bio/rotate.php'></div><a class='bio-text'>".$info['text']."</a>";
}
?>
I've tried the following to no avail:
PHP Code:
<?php 
// Collects data from "friends" table 
$data mysql_query("SELECT * FROM bio"
or die(
mysql_error());

while(
$info mysql_fetch_array$data )) 

Print 
"<div class='bio-image'><img src='images/bio/rotate.php'></div><a class='bio-text'>"addslashes(.$info['text'].)"</a>";
}
?>
And I've also tried:
PHP Code:
<?php 
// Collects data from "friends" table 
$data mysql_query("SELECT * FROM bio"
or die(
mysql_error());

while(
$info mysql_fetch_array$data )) 

Print 
addslashes("<div class='bio-image'><img src='images/bio/rotate.php'></div><a class='bio-text'>".$info['text']."</a>");
}
?>
But again, this didn't work...

The page in question is here if you would like to see it in action...

Any help would be greatly appreciated!!!
hj8ag is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 02-27-2008, 10:47 AM Re: ' in PHP/MySQL...
tripy's Avatar
Do not try this at home!

Posts: 3,621
Name: Thierry
Location: I'm the uber Spaminator !
Trades: 0
This is typical of a copy/paste between applications with different charset, or from word.

This character represent a "symbol" that the font have no representation for. I know that word replace hypens with those, as it does with the "..." and some others characters.

Nothing much to do here except a search/replace or re-write those hyphens with the correct ascii characters.
__________________
Only a biker knows why a dog sticks his head out the window.
tripy is offline
Reply With Quote
View Public Profile Visit tripy's homepage!
 
Old 02-27-2008, 12:05 PM Re: ' in PHP/MySQL...
JeremyMiller's Avatar
WT Moderator

Posts: 1,712
Name: Jeremy Miller
Location: Las Vegas, NV
Trades: 0
I use a modified version of the code at http://shiflett.org/blog/2005/oct/co...uotes-with-php to handle crappy stuff entered by client's who don't understand that a smart quote is not smart at all. That may help you by converting them into HTML entities.
__________________
Jeremy Miller

Please login or register to view this content. Registration is FREE
JeremyMiller is offline
Reply With Quote
View Public Profile Visit JeremyMiller's homepage!
 
Reply     « Reply to ' in PHP/MySQL...
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.18664 seconds with 12 queries