View Single Post
Old 06-06-2005, 07:58 AM   #3 (permalink)
draven77
Recruit
 
Join Date: May 2005
Posts: 13
draven77 is on a distinguished road
Try this ----

// Connect up code here

Code:
$result = mysql_query("SELECT make, model FROM cardetail") or die ("no DB connection<br><br>".mysql_error() );
		while($r=mysql_fetch_array($result))
		{    
			// ESTABLISH FIELD NAMES
			$make=$r["make"];
			$model=$r["model"];
			
			echo "<a href=\"productdetails.php?id=$make\">".$model."</a><br />";
		}
Just some advice, it looks like your table may not be structure optimally.. I'd use a car_id. Consider fields like this--

car_id
car_make
car_model

Then you'd pass the id instead of the $make
Code:
echo "<a href=\"productdetails.php?car_id=$car_id\">".$model."</a><br />";
And your query would make more sence on your details page

Code:
SELECT * FROM cardetail WHERE car_id = $car_id
draven77 is offline   Reply With Quote