Dethman Posted August 15, 2008 Share Posted August 15, 2008 Ok I am making a gallery page for a website of mine and it wont echo out the $gallery var like it should code is below any help anyone can provide is awesome! <?php //Set Requires require("functions/main-functions.php"); require("db_connect.php"); // Lets Start The Fun! $page=$_GET['itemlist']; if($page=""){ $QUERY = "SELECT * FROM `Gallery` ORDER BY Sequence ASC"; $V=MYSQL_QUERY($QUERY) or die(mysql_error()); $row=mysql_fetch_array($V); $count=mysql_num_rows($V); if($count > 0){ $gallery=" <div class='black-box'> <h2><em>".$row['Gallery_Name']."</em> collection</h2> <p><img src='".$row['Gallery_Image']."' width='120' height='105' alt='Gallery Images!' /></p> <p>".$row['Gallery_Info'].".</p> <p class='more'>> > <a href='index.php?page=Gallery&itemlist=".$row['Gallery_ID']."'>More</a></p> </div> "; }else{ $gallery="The website manager has not added any <b>Galleries</b> to this page, Please try back at a later time."; } } elseif($page !=""){ $sql_query="SELECT * FROM `Gallery_Items` WHERE `Gallery_ID` ='$page' ORDER BY `Gallery_ID` ASC"; $Rez=mysql_query($sql_query) or die("An Error Occured <br />".mysql_error()); $item=mysql_fetch_array($Rez); $count=mysql_num_rows($Rez); if($count > 0){ $gallery="<h3>We currently have ".$item['amt_stock']." ".$row['Gallery_Name']." in stock!</h3><br><img src='gallery_images/".$item['Item_Image']."' width='100' height='100'> ".$item['Item_Info']." "; } else { $gallery="The website manager has not added any items to this gallery yet, Please try back at a later time."; } } ?> Echo Statement: <?php echo($gallery); ?> Thank you for your help! Brian Flores CEO, NimbusGames,llc Link to comment https://forums.phpfreaks.com/topic/119785-solved-gallery-wont-display-and-dosnt-error-out-can-someone-look-at-this/ Share on other sites More sharing options...
Third_Degree Posted August 15, 2008 Share Posted August 15, 2008 Use this at the top of your code: <?php error_reporting(E_ALL); ?> Also, the code to the required scripts might help. Is this a premade script? Link to comment https://forums.phpfreaks.com/topic/119785-solved-gallery-wont-display-and-dosnt-error-out-can-someone-look-at-this/#findComment-617122 Share on other sites More sharing options...
Dethman Posted August 15, 2008 Author Share Posted August 15, 2008 I just made that script a few minutes ago also where do I put that strip of code at the top? Link to comment https://forums.phpfreaks.com/topic/119785-solved-gallery-wont-display-and-dosnt-error-out-can-someone-look-at-this/#findComment-617123 Share on other sites More sharing options...
chronister Posted August 15, 2008 Share Posted August 15, 2008 yes, the first line in the script. I would seriously recommend doing something like this in a page that is used throughout the site. I have a common header page that every page in my site uses. I have this at the top of that. if($_GET['debug'] == 'yes') { ini_set('error_reporting', E_ALL); } else { ini_set('error_reporting', E_ERROR); } This hides everything but ERRORs, some notices will make the script fail as well but all in all this has saved me loads of time, because if a page does not do what I expect, I append ?debug=yes to the end of the url and it gives me the errors. This could be a bad thing in a live site, so either don't keep it like this or make it so another variable has to be passed such as ?debug=yes&secretCode=you_will_never_guess_this nate Link to comment https://forums.phpfreaks.com/topic/119785-solved-gallery-wont-display-and-dosnt-error-out-can-someone-look-at-this/#findComment-617124 Share on other sites More sharing options...
Dethman Posted August 15, 2008 Author Share Posted August 15, 2008 Um guys this code you gave me for the top didnt do anything everything stayed the same :S Can you just look at the code real quick? Link to comment https://forums.phpfreaks.com/topic/119785-solved-gallery-wont-display-and-dosnt-error-out-can-someone-look-at-this/#findComment-617127 Share on other sites More sharing options...
Dethman Posted August 15, 2008 Author Share Posted August 15, 2008 Ok guys I am begging you this is driving me crazy! Ive added while statements to the code but it still dosnt work heres the new modified code. <?php //Set Requires require("db_connect.php"); // Lets Start The Fun! $item_list=$_GET['itemlist']; if($item_list=""){ $QUERY = "SELECT * FROM `Gallery` ORDER BY Sequence ASC"; $V=MYSQL_QUERY($QUERY) or die("An Error Occured <br />".mysql_error()); $row=mysql_fetch_array($V); $count=mysql_num_rows($V); if($count > 0){ while($row=mysql_fetch_array($V)){ $gallery=" <div class='black-box'> <h2><em>".$row['Gallery_Name']."</em> collection</h2> <p><img src='".$row['Gallery_Image']."' width='120' height='105' alt='Gallery Images!' /></p> <p>".$row['Gallery_Info'].".</p> <p class='more'>> > <a href='gallery.php?itemlist=".$row['Gallery_ID']."'>More</a></p> </div> "; } } else { $gallery="The website manager has not added any <b>Galleries</b> to this page, Please try back at a later time."; } } elseif($item_list !=""){ $sql_query="SELECT * FROM `Gallery_Items` WHERE `Gallery_ID` ='$page' ORDER BY `Gallery_ID` ASC"; $Rez=mysql_query($sql_query) or die("An Error Occured <br />".mysql_error()); $item=mysql_fetch_array($Rez); $count=mysql_num_rows($Rez); if($count > 0){ while($item=mysql_fetch_array($Rez)){ $gallery = "<h3>We currently have ".$item['amt_stock']." ".$row['Gallery_Name']." in stock!</h3><br><img src='gallery_images/".$item['Item_Image']."' width='100' height='100'> ".$item['Item_Info']." "; } } else { $gallery="The website manager has not added any items to this gallery yet, Please try back at a later time."; } } ?> Please Help :S Link to comment https://forums.phpfreaks.com/topic/119785-solved-gallery-wont-display-and-dosnt-error-out-can-someone-look-at-this/#findComment-617151 Share on other sites More sharing options...
MasterACE14 Posted August 15, 2008 Share Posted August 15, 2008 I spot 1 problem so far.... if($item_list=""){ thats assign $item_list, not checking if it equals nothing. change it to this: if(empty($item_list)){ Link to comment https://forums.phpfreaks.com/topic/119785-solved-gallery-wont-display-and-dosnt-error-out-can-someone-look-at-this/#findComment-617170 Share on other sites More sharing options...
chronister Posted August 15, 2008 Share Posted August 15, 2008 <?php ini_set('error_reporting', E_ALL); // this does not reveal any errors?? //Set Requires require("db_connect.php"); // Lets Start The Fun! $item_list=$_GET['itemlist']; if($item_list=""){ $QUERY = "SELECT * FROM `Gallery` ORDER BY Sequence ASC"; $V=MYSQL_QUERY($QUERY) or die("An Error Occured <br />".mysql_error()); $row=mysql_fetch_array($V); $count=mysql_num_rows($V); if($count > 0){ while($row=mysql_fetch_array($V)){ $gallery=" <div class='black-box'> <h2><em>".$row['Gallery_Name']."</em> collection</h2> <p><img src='".$row['Gallery_Image']."' width='120' height='105' alt='Gallery Images!' /></p> <p>".$row['Gallery_Info'].".</p> <p class='more'>> > <a href='gallery.php?itemlist=".$row['Gallery_ID']."'>More</a></p> </div> "; } } else { $gallery="The website manager has not added any <b>Galleries</b> to this page, Please try back at a later time."; } } elseif($item_list !=""){ $sql_query="SELECT * FROM `Gallery_Items` WHERE `Gallery_ID` ='$page' ORDER BY `Gallery_ID` ASC"; $Rez=mysql_query($sql_query) or die("An Error Occured <br />".mysql_error()); $item=mysql_fetch_array($Rez); $count=mysql_num_rows($Rez); if($count > 0){ while($item=mysql_fetch_array($Rez)){ $gallery = "<h3>We currently have ".$item['amt_stock']." ".$row['Gallery_Name']." in stock!</h3><br><img src='gallery_images/".$item['Item_Image']."' width='100' height='100'> ".$item['Item_Info']." "; } } else { $gallery="The website manager has not added any items to this gallery yet, Please try back at a later time."; } } ?> If adding that line at the top in THIS page don't do anything, then go through the code and place echo's in the if/else statements to see what bombs out. This is the standard procedure I take. Look at each piece of the code as individual blocks and see where it stops up. *edit*.... I am a moron, I realize now you have marked this as solved. duh! Link to comment https://forums.phpfreaks.com/topic/119785-solved-gallery-wont-display-and-dosnt-error-out-can-someone-look-at-this/#findComment-617707 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.