Jump to content

[SOLVED] Gallery Wont Display and Dosnt error out Can someone look at this?


Dethman

Recommended Posts

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

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

 

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

<?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!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.