Jump to content

[SOLVED] how do i retrieve text and display to user in proper english?


jeger003

Recommended Posts

i have a classified site and the titles of my ads are stored like:

 

Brand+new+spaceship+for+sale

 

i want it to display with out the "+" how do i do this?

 

this is my code so far below

$sql_query = "SELECT user_id FROM sessions WHERE listings_session = \"".$_COOKIE["listing_session"]."\"";
$results = mysql_query($sql_query) or die(mysql_error());
while($user_id = mysql_fetch_array($results))

$query = 'SELECT title FROM listings WHERE seller = '.$user_id['user_id'].' ';

$result2 = mysql_query($query) or die(mysql_error());

while($row = mysql_fetch_array($result2)){
echo "<br>".$row['date'].".";

}

 

http://php.net/str_replace

 

 

echo str_replace('+', ' ', 'hello+world');

 

oh awesome!!

it worked great, but now it won't display (',&) characters

 

an example of what it displayed

 

Selling - Bike %2AMINT Condition%2A ----supposed to display

Selling - Bike *MINT Condition*

 

American Gov%27t - Items For Sale----supposed to display American Gov't - Items For Sale

 

code after your add


$sql_query = "SELECT user_id FROM sessions WHERE listings_session = \"".$_COOKIE["listings_session"]."\"";
$results = mysql_query($sql_query) or die(mysql_error());
while($user_id = mysql_fetch_array($results))

$query = 'SELECT title FROM listings WHERE seller = '.$user_id['user_id'].' ';

$result2 = mysql_query($query) or die(mysql_error());

while($row = mysql_fetch_array($result2)){

echo "<br>".str_replace('+', ' ', $row['title'])."<br>"; 

}

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.