Error in db init : ".mysql_error()."

"; return; } mysql_select_db( $db_name, $dbmattiouz ); $query = "SELECT * FROM photos where visibility like 'public' ORDER BY RAND() LIMIT 1"; $queryRes = mysql_query($query, $dbmattiouz); if (! $queryRes) { echo "

Error in the query : ".mysql_error()."

"; return; } // Format XHTML output // $row[0] is id // $row[1] is filename // $row[2] is path // $row[3] is title // $row[4] is date // $row[5] is visibility // $row[6] is city // $row[7] is state // $row[8] is country // $row[9] is position $htmlText = "

No photo found in the db. Sorry.

"; if ($row = mysql_fetch_row($queryRes)){ $photo = str_replace("/web/www/", "/", $row[2])."/".str_replace(".jpg", "-sm.jpg", $row[1]); $title = "$row[3], taken $row[4] in $row[6], $row[7] ($row[8])"; $title = mb_convert_encoding($title, "UTF-8", "ISO-8859-1"); // convert to UTF-8 $alt = "$row[3]"; $alt = mb_convert_encoding($alt, "UTF-8", "ISO-8859-1"); // convert to UTF-8 $lat = strtok($row[9], ","); $lon = strtok(","); $photoLinkMed = str_replace("/web/www/", "/", $row[2])."/".str_replace(".jpg", "-med.public.html", $row[1]); $photoLinkSm = str_replace("-med", "-sm", $photoLinkMed); $htmlText = "
"; $htmlText .= ""; $htmlText .= "\"$alt\""; $htmlText .= "
"; $htmlText .= "$lat
"; $htmlText .= "$lon
"; $htmlText .= "
"; } echo $htmlText; } // End randomPhoto() ?>