bravo14 Posted April 8, 2009 Share Posted April 8, 2009 Hi guys I am trying to create a gallery, the images are uploading ok, but I can't get them to display below is the code <?php include("admin/config.inc.php"); // initialization $result_array = array(); $counter = 0; $cid = (int)($_GET['cid']); $pid = (int)($_GET['pid']); // Thumbnail Listing if( $cid && empty( $pid ) ) { $number_of_thumbs_in_row = 5; $result = mysql_query( "SELECT photo_id,photo_caption,photo_filename FROM gallery_photos WHERE photo_category='1'" ); $nr = mysql_num_rows( $result ); if( empty( $nr ) ) { $result_final = "\t<tr><td>No Category found</td></tr>\n"; } else { while( $row = mysql_fetch_array( $result ) ) { $result_array[] = "<a href='gallery.php?cid=$cid&pid=".$row[0]."'><img src='http://www.projectrenovations.co.uk/admin/".$images_dir."/tb_".$row[2]."' border='0' alt='".$row[1]."' /></a>"; print_r($row); } mysql_free_result( $result ); $result_final = "<tr>\n"; foreach($result_array as $thumbnail_link) { if($counter == $number_of_thumbs_in_row) { $counter = 1; $result_final .= "\n</tr>\n<tr>\n"; } else $counter++; $result_final .= "\t<td>".$thumbnail_link."</td>\n"; } if($counter) { if($number_of_photos_in_row-$counter) $result_final .= "\t<td colspan='".($number_of_photos_in_row-$counter)."'> </td>\n"; $result_final .= "</tr>"; } } } // Full Size View of Photo else if( $pid ) { $result = mysql_query( "SELECT photo_caption,photo_filename FROM gallery_photos WHERE photo_id='".addslashes($pid)."'" ); list($photo_caption, $photo_filename) = mysql_fetch_array( $result ); $nr = mysql_num_rows( $result ); mysql_free_result( $result ); if( empty( $nr ) ) { $result_final = "\t<tr><td>No Photo found</td></tr>\n"; } else { $result = mysql_query( "SELECT category_name FROM gallery_category WHERE category_id='1'" ); list($category_name) = mysql_fetch_array( $result ); mysql_free_result( $result ); $result_final .= "<tr>\n\t<td align='center'> <br /> <img src='".$images_dir."/".$photo_filename."' border='0' alt='".$photo_caption."' /> <br /> $photo_caption </td> </tr>"; } } // Final Output echo <<<__HTML_END <table width='100%' border='0' align='center' style='width: 100%;'> $result_final </table> __HTML_END; ?> The images aren't displaying, I am seeing no content. Where have I gone wrong? Mark Quote Link to comment https://forums.phpfreaks.com/topic/153207-gallery-images-not-showing/ Share on other sites More sharing options...
Maq Posted April 9, 2009 Share Posted April 9, 2009 If you are seeing no content then most likely you have a syntactial error. Put this at the top of your page and tell me what errors output: ini_set ("display_errors", "1"); error_reporting(E_ALL); Which images are you referring to? The whole page doesn't show any images at all? If that's the case then you probably have the wrong path. Echo out your variables to ensure they are pointed the right directory and image. Quote Link to comment https://forums.phpfreaks.com/topic/153207-gallery-images-not-showing/#findComment-805082 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.