Jump to content

Not sure how to Honestly


SkyRanger

Recommended Posts

$mysqli = new mysqli($DB_HOST, $DB_USER, $DB_PASS, $DB_NAME);
if (mysqli_connect_errno())
{
       printf("Connect failed: %s\n", mysqli_connect_error());
       exit();
}

$phtocat = $_GET['cid'];

$query = "SELECT  * FROM `gallery_photos` WHERE photo_category='$phtocat' and `photo_owner`='$client'";
$result = $mysqli->query($query) or die($mysqli->error.__LINE__);

//Define number of columns to use
$maxColumns  = 5;

$count = 0;              //Var to count records
$categoryList = ''; //Var to hold HTML output
while($row = $result->fetch_assoc())
{
       $count++; //Increment count

       //Open new row if first record in row
       if($count % $maxColumns == 1)
       {
               $categoryList .= "<tr>\n";
       }
$image_dir = "members/$client/photos";
$pid = $row['photo_id'];
      //Output current record
       $categoryList .= "<td align=center width=20%>
<a href={$image_dir}/{$row[photo_filename]} rel=lightbox title='{$row[photo_caption]}'><img src={$image_dir}/tb_{$row[photo_filename]} border='0' alt='{$row[photo_caption]}' /></a>
<br>
<A HREF=\"javascript:popUpPic('printimage.php?pid={$pid}&client={$client}')\"><img src=images/print.jpg></a>
<a href=\"downloadimage.php?file={$image_dir}/{$row[photo_filename]}\" onclick=\"this.blur();\"><img src=images/download.jpg></a>
<a href=removephoto.php?pid=$pid&photo_owner=$client><img src=images/delete2.jpg></a>
</td>\n";

       //Close row if last record in row
       if($count % $maxColumns == 0)
       {
               $categoryList .= "</tr>\n";
       }
}

//Close last row if needed
if($maxColumns % $count != 0)
{
       $categoryList .= "</tr>\n";
} 

?>
<table align="center" width="95%" border="0">
<?php echo $categoryList; ?>
</table>

 

Error I am getting:

Warning: Division by zero in showphoto.php on line 259

 

I am not sure how to make it say "There are no pictures in this category"

 

Could somebody please give me a hand. I have tried an else { echo "There are no......."; but with no luck I still get the error.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.