I've been pulling my hair out for over two hours because I can't find a solution to this. For some reason, the $photosections variable is not being pulled ... see the code below for more of an explanation.
######################
THE CODE...
######################
$result = mysql_query("SELECT photoid, photosections, description, DATE_FORMAT(photodate, '%Y') as photo_date, filename FROM gallery WHERE photoid=$photoid",$db);
$myrow = mysql_fetch_array($result);
printf("<img src=\"gallery/images/%s.jpg\">", $myrow["filename"]);
$section = $myrow["$photosections"];
// If I set the following in php...
// $section = "01, 09, 13";
// ... then the everything works fine.
// but when I try to pull $myrow["$photosections"]
// from the database, everything doesn't work
if (ereg("01",$section)) {
$eventname = "EVENT NAME 1";
} elseif (ereg("02",$section)) {
$eventname = "EVENT NAME 2";
} elseif (ereg("03",$section)) {
$eventname = "EVENT NAME 3";
} elseif (ereg("04",$section)) {
$eventname = "EVENT NAME 4";
} elseif (ereg("05",$section)) {
$eventname = "EVENT NAME 5";
} elseif (ereg("06",$section)) {
$eventname = "EVENT NAME 6";
} elseif (ereg("15",$section)) {
$eventname = "EVENT NAME 7";
}
##########################
Any ideas? I'm lost...