Search the Community
Showing results for tags 'mysql_fetch_array() expects p'.
-
I am suddenly getting an error on a client's page: http://kajagamdesign.com/portfolio.php Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in /home1/kajagam/public_html/portfolio.php on line 13 Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in /home1/kajagam/public_html/portfolio.php on line 26 Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in /home1/kajagam/public_html/portfolio.php on line 45 Here is the code in question: //GET PRIMARY PORTFOLIO ID IF NONE CAPTURED if (!$c_page) { $query = "SELECT id FROM gallery_rooms ORDER BY sort ASC LIMIT 1"; $result = mysql_query($query); while($row = mysql_fetch_array($result)) { $c_page = $row['id']; } } //---------------------------------------------------- //---------------------------------------------------- //FORMAT PORTFOLIO SIDE NAV $port_nav = ''; $query = "SELECT id, title FROM gallery_rooms ORDER BY sort ASC"; $result = mysql_query($query); while($row = mysql_fetch_array($result)) { $id = $row['id']; $title = trim(stripslashes($row['title'])); if ($c_page == $id) { $active = ' class="active_port"'; } else { $active = ''; } $port_nav .= '<li'.$active.'><a href="portfolio.php?p='.$id.'">'.$title.'</a></li>'; } //---------------------------------------------------- //---------------------------------------------------- //GET PORTFOLIO HEADER image $query2 = "SELECT * FROM photos WHERE category = '$c_page'"; $result2 = mysql_query($query2); while($row = mysql_fetch_array($result2)) { $imageID = $row['id']; $alt = trim(stripslashes($row['alt'])); $img_title = trim(stripslashes($row['title'])); $filename = $row['filename']; list($width, $height, $type, $attr) = getimagesize('photos/'.$filename); } if (!$filename) { $filename = 'not_available.jpg'; } $header_img = '<img src="photos/'.$filename.'" alt="'.$alt.'" title="'.$img_title.'" '.$attr.' />'; //---------------------------------------------------- We have not made any changes to the page and it was working. I did not do the original coding and am not very familiar with PHP. Any help is greatly appreciated.