Easy peasy for pros but im stumped

Hey guys can anyone tell me what is wrong with this code, it is meant to show images from the database however im trying to insert urlencode() so that it also shows images that have spaces in their name?
[php] <?php

$query = mysql_query(“SELECT proid FROM fck_data WHERE id = 1”);
$raw_result1 = mysql_fetch_array($query);
$proid = $raw_result1[‘proid’];

//Retrieves data from MySQL
$data = mysql_query(“SELECT filename FROM xcart_images_D WHERE id = ‘$proid’”) or die(mysql_error());

while($info = mysql_fetch_array( $data ))
{

//Outputs the image and other data
Echo “<img src=http://www.mywebsite.com/images/D/”.urlencode($info[‘filename’]).">
";

}
?>[/php]

Your help is greatly appreciated.

You should be using rawurlencode() which will replace spaces with %20

Great advice dude, worked a treat!

Sponsor our Newsletter | Privacy Policy | Terms of Service