while (($fyl = @readdir($dirID)) !== false) {
array_push($fylArray, "$locationPath/$fyl");
if (is_file("$locationPath/$fyl") && preg_match('/^[a-zA-Z0-9]+/i', $fyl)) $imageSQLString .= "'" . mysql_escape_string($fyl) . "', ";
}
$imageSQLString = trim($imageSQLString);
Very very simple function.. will read through a directory and create a SQL string that will look like this:
('banner1.jpg', 'kyrka_gray.jpg', 'kyrka.jpg', 'main.gif', 'phil_and_christy.JPG', 'phil_on_primrose_hill_london.jpg', 'phil_straddling_the_hemispheres_in_greenwich.jpg', 'screams.jpg', 'temple_church_london.jpg', 'val_black.jpg', 'val.jpg', 'Val.jpg', 'westminster_abbey_2.jpg',
All I want to do is lob off the last comma and replace with ')'.. but.. it can't find ANY commas in $imageSQLString, not one!
preg_match('/,/', $imageSQLString)
returns null
strpos(',', $imageSQLString)
returns null as well
but if I display it:
die($imageSQLString);
Here it is:
('banner1.jpg', 'kyrka_gray.jpg', 'kyrka.jpg', 'main.gif', 'phil_and_christy.JPG', 'phil_on_primrose_hill_london.jpg', 'phil_straddling_the_hemispheres_in_greenwich.jpg', 'screams.jpg', 'temple_church_london.jpg', 'val_black.jpg', 'val.jpg', 'Val.jpg', 'westminster_abbey_2.jpg',
Based on the code you see, what do you suggest I do? I can't form a proper SQL string unless I fix this one small problem!
Thanx
Phil