here is the entire code, I'm new to this so I appreciate all your help
I marked errored lines with "***"
if(isset($_GET['cat']))
{$cat = mysql_real_escape_string($_GET['cat']); }
*** else
{$cat = '';}
$query2 = mysql_query("SELECT * FROM Photos_Cat WHERE PhotosCat_ID='$cat'");
*** while ( $imgcat = mysql_fetch_array($query2))
{
$id = $imgcat['PhotosCat_ID'];
$category = $imgcat['PhotosCat_Category'];
echo("<h1><b>" . $category . " Gallery</h1></b>");
}
if ($cat == '1') {
*** $query = mysql_query("SELECT DATE_FORMAT(Photos_Date, '%b %Y') as Photos_NewDate, Photos_Title, Photos_FileName, Photos_FileName_sm FROM Photos");
while ( $img = mysql_fetch_array($query))
{
$id = $img['Photos_ID'];
$title = $img['Photos_Title'];
$filename = $img['Photos_FileName'];
$filename_sm = $img['Photos_FileName_sm'];
$category = $imgcat['Photos_Category'];
$date = $img['Photos_Date'];
$newdate = $img['Photos_NewDate'];
if ($date == "0000-00-00"){
echo("<a href='media/images/" . $filename . "' rel='lyteshow[" . $cat . "]' title='" . $title . "'><img class='images' src='media/images/" . $filename_sm . "'></a> ");
}
else {
echo("<a href='media/images/" . $filename . "' rel='lyteshow[" . $cat . "]' title='" . $title . ", " . $newdate . "'><img class='images' src='media/images/" . $filename_sm . "'></a> ");
}
}
echo("<p> </p>");}
else{
$query = mysql_query("SELECT DATE_FORMAT(Photos_Date, '%b %Y') as Photos_NewDate, Photos_Title, Photos_FileName, Photos_FileName_sm FROM Photos WHERE PhotosCat_ID='$cat'");
*** while ( $img = mysql_fetch_array($query))
{
$id = $img['Photos_ID'];
$title = $img['Photos_Title'];
$filename = $img['Photos_FileName'];
$filename_sm = $img['Photos_FileName_sm'];
$category = $img['Photos_Category'];
$date = $img['Photos_Date'];
$newdate = $img['Photos_NewDate'];
if ($date == "0000-00-00"){
echo("<a href='media/images/" . $filename . "' rel='lyteshow[" . $cat . "]' title='" . $title . "'><img class='images' src='media/images/" . $filename_sm . "'></a> ");
}
else {
echo("<a href='media/images/" . $filename . "' rel='lyteshow[" . $cat . "]' title='" . $title . ", " . $newdate . "'><img class='images' src='media/images/" . $filename_sm . "'></a> ");
}
}
}