Here is the code. For a short time, I will leave the test results up at superiorminitrucks.com/inventory

Clearly, I need to stop it from displaying the final entry twice..

Thanks in advance..

<?php

		$db_connection = @mysql_connect("######", "#####", "####");
		
		if (!$db_connection) 
			exit();	
			
		mysql_select_db("tefflox", $db_connection);

		$result = mysql_query("SELECT * FROM trucks");

			while($row = mysql_fetch_array($result)) {
			  if($row['id']){
				$lightbox1 = $row['relpath-box1'];
				$lightbox2 = $row['relpath-box2'];			
				$lightbox3 = $row['relpath-box3'];			
				$lightbox4 = $row['relpath-box4'];
				$primary   = $row['relpath-primary'];
				$gallery1  = $row['relpath-gallery1'];
				$gallery2  = $row['relpath-gallery2'];						
				$gallery3  = $row['relpath-gallery3'];			
				$year      = $row['year'];
				$make      = $row['make'];			
				$model     = $row['model'];			
				$miles     = $row['miles'];
				$comment   = $row['comment'];
				$option1   = $row['option1'];
				$option2   = $row['option2'];
				$option3   = $row['option3'];
				$option4   = $row['option4'];
				$option5   = $row['option5'];
				$option6   = $row['option6'];
				$option7   = $row['option7'];
				$option8   = $row['option8'];
			  }																	

		
        echo("<tr>\n");
        echo("  <td width=\"320\">\n");
        echo("    <a href=\"../inventory/trucks/". $lightbox1 ."\" title=\"\" class=\"smoothbox\" rel=\"inventory/trucks/\"><img src=\"../inventory/trucks/". $primary ."\" alt=\"1\" /></a></td>\n");
        echo("  <td width=\"320\">". $year . " " . $make . " " . $model . "<br/><br/>". $miles ."<br/>". $comment ."<br/><br/>\n");
        echo("    <a href=\"../inventory/trucks/" . $lightbox2 . "\" title=\"\" class=\"smoothbox\" rel=\"inventory/trucks/\"><img style=\"float: left\" src=\"../inventory/trucks/". $gallery1 ."\" alt=\"2\" /></a>\n");
        echo("    <a href=\"../inventory/trucks/" . $lightbox3 . "\" title=\"\" class=\"smoothbox\" rel=\"inventory/trucks/\"><img style=\"float: left\" src=\"../inventory/trucks/". $gallery2 ."\" alt=\"3\" /></a>\n");
        echo("    <a href=\"../inventory/trucks/" . $lightbox4 . "\" title=\"\" class=\"smoothbox\" rel=\"inventory/trucks/\"><img style=\"float: left\" src=\"../inventory/trucks/". $gallery3 ."\" alt=\"4\" /></a>\n");          
        echo("  </td>\n");
        echo("  <td>". $option1 ."<br/>". $option2 ."<br/>". $option3 ."<br/><br/>". $option4 ."<br/>". $option5 ."<br/>". $option6 . "<br/>". $option7 ."<br/>". $option8 ."</td>\n");
        echo("</tr>\n\n");				
				
		}
	
		
		mysql_close($db_connection);
		        
        ?>

If you want it to stop after 10 add LIMIT 10 to the end of your SQL query. Otherwise it will loop through all the records.

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.