aaggghhhhh - this is really annoying and i have no idea why its doing this.
I've got a function to return a filename for a section. But it always returns the filename with a space at the beginning(%20);
<img src="/uploadedfiles/thumbs/<?=getSectionMedia($sec_idb,"","","LIMIT 1")?>" alt="<?=$sec_safetitle?>" />
'%2022_fox1%20for%20web.jpg'
22_ is the beginning of the filename in the field of the table. I cant str_replace as the filenames actually have spaces in them and there's already a few hundred in the table.
can anyone see where this space might be coming from - i'm stumped!
best, D.
function getSectionMedia($id, $section, $conition_a, $condition_b) {
include("conf.php");
$connection = mysql_connect($host, $user, $pass) or die ("Unable to connect!");
mysql_select_db($db) or die ("Unable to select database!");
$sqlb = mysql_query("SELECT * FROM site_sections WHERE sec_section='$id' ORDER BY sec_position, sec_title LIMIT 1");
while($myrow=mysql_fetch_array($sqlb)){
$sec_idb = $myrow["sec_id"];
}
$query="SELECT * FROM site_media WHERE med_sec_id='$sec_idb' ORDER BY med_position $condition_b";
$result=mysql_query($query);
while($row=mysql_fetch_array($result)){
$med_filename=$row['med_filename'];
return"$med_filename";
}
}
//
<?=getSectionMedia($sec_idb,"","","LIMIT 1")?>