Forum Moderators: coopster
Then as you loop through you can output your values from your database and your html together
this is a good place to start
Basics of extracting data from MySQL using PHP [webmasterworld.com]
<ul>
<?php
include "db.inc.php";
$sql = "SELECT DISTINCT Make FROM table ";
$makeresults=@mysql_query($sql);
if(!$makeresults){
exit('<p>Error with Query...Error:' . mysql_error() . '</p>');
}
while($makerow=mysql_fetch_array($makeresults)){
$Make=$makerow['Make'];
echo "<li><a href=\"http://www.yoursite.com/yourpage.php?Make=" . $Make . "\" class=\"class\">". $Make. "</a>\n";
echo '<ul>';
$sql2 = "SELECT DISTINCT Model FROM table WHERE Make='$Make'";
$modelresults=@mysql_query($sql2);
if(!$modelresults){
exit('<p>Error with Query...Error:' . mysql_error() . '</p>');
}
while($modelrow=mysql_fetch_array($modelresults)){
$Model=$modelrow['Model'];
echo "<li><a href=\"http://www.yoursite.com/yourpage.php?MakeModel=". $Make . '-' . $Model. "\">$Model</a></li>\n";
}
echo "</ul></li>";
}
?>
</ul>
I replaced some of the identifying variables but I think you can get the idea. It populates a list of "makes" in stock and gives each one a sublist of their models.
[edited by: jatar_k at 6:29 pm (utc) on May 8, 2008]
[edit reason] added some line breaks [/edit]
And, I am not really sure how the CSS would go... maybe you could post your css as well?
[edited by: Spiceydog at 4:06 pm (utc) on May 8, 2008]