Hi everyone
Im trying to get a query to return a hyperlink, used a couple of different ways with no success. I would like it to return all the makes in the cardetails table with hyperlinks to a page that has some feilds of the cardetail table of the selected make.
The following code only outputs "Car Details:"
products.php
PHP Code:
<?PHP
include 'connectdb.php';
session_start();
$sql="SELECT make FROM cardetail";
$result = mysql_query($sql,$db);
echo "Car Details:<br>";
$i=1;
while ($myrow = mysql_fetch_array($result))
{
echo "<a href=\"productdetails.php?id=".$myrow["Make"]."\">".$myrow["Model"]."</a><br>";
$i=$i+1;
if($i>5)
break;
}
?>
Heres the connect to database file
PHP Code:
<?PHP
$db=mysql_connect("localhost", "XXX", "XXX")
or die("Could not connect to localhost.");
if (!@mysql_select_db("cardb",$db))
{
exit('Error. Unable to select database.');
} else {
//Connection successful
}
?>