Hi, im currently building a photography portfolio website for ym dissertation and i have a quick question.

The site has several categories of photos, would it be easier storing all in photos in one table and adding a album and field or storing each separate category,of photos, into its own table? I have a script which gets the photos from the database which is below, if its easier storing all the photos in one table how would i go about modifying this script to select the photos with a specific category. I hope that makes sense. thanks


require "common.php";

$q = "SELECT id, title, source FROM sports";

$result = $mysqli->query($q) or die(mysql_error($mysqli));  
 if ($result) {  

while ($row = $result->fetch_object()) {  
		$title = $row->title;
		$source = $row->source;
		$id = $row->id;
		echo "<a class='gallery' rel='usa' id='$id' alt='$title' href='img/sports/$source'>  <img src='img/sports_tn/$source'  />   </a> \n";
8 Years
Discussion Span
Last Post by cwarn23

In my opinion, as long as you don't have more than 500,000 photos to list, you should be able to store them all in the one table without the slightest cpu problem providing the script is written correctly. But if you plan to have more than five hundred thousand (500,000) photos then you will probably want seperate tables for each category to save cpu.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.