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
https://forums.phpfreaks.com/topic/96530-gallery-script-easy-one-please-help/
Share on other sites

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.