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

<?php

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";
		}		
}
?>

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.