Jump to content

Gallery script (Easy one) please help


emediastudios

Recommended Posts

I just want the script that draws all my images from my gallery (sql database table name : gallery, 3 fields - ID, title and photo.

and places them side by side with there $title below it,

I want to build a scrolling gallery that i will place inside a div.

when they click the image it will load in a new page.

 

I have this in my admin section but want to edit it so i can use it in my public galley minus the delete option and login requirements.

 

Heres the code i have now.

 

<?php
if($secret == "56"){
$items_per_row = "3";
$width_of_thumb = "100";
$height_of_thumb ="100";
$q = "SELECT * FROM gallery";
$r = mysql_query($q) or die(mysql_error());
if(mysql_num_rows($r) > 0)
{
  $content .="<table style='width:100%; height: 100%;'>";
  while($result = mysql_fetch_array($r)){
   $ctr++;
   if($ctr == $items_per_row){ 
    $content .= "</tr><tr>";
    $ctr=1;
   }  
   $content .="<td><a href='" .$result[photo]. "'><img src='".$result[photo]."' width='".$width_of_thumb."' height='".$width_of_thumb."'><br><left>".$result[title]."<br><a href='admin.php?p=delete_image&id=".$result[iD]."'>Delete This Image</a></left></a></td>";
  
  }
$content .="</table>";
} 
else $content .= "No Photos Uploaded Yet. <br /><a href=\"admin.php\">Click here to return to admin menu</a>";
}
else $content .= "You Must Be Logged In TO Do That. <br /><a href=\"admin.php\">Click here to return to admin menu</a>";
?>

 

Even if i get a new code and dont use this one be ok.

 

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.