Here is my database inserted in an HTML page:
<HEAD>
<TITLE>Database Connection</TITLE>
</HEAD>
<BODY>
<?
$connection = mysql_connect ("localhost","root","") or
die ("No collegamento a database");
$db = mysql_select_db ("products", $connection) or
die ("Non trovo il database");
$sql = "select code, quant from inventory
where quant > 0 order by quant desc";
$sql_result = mysql_query ($sql, $connection) or
die ("Non posso eseguire la ricerca");
print "
<table border=0>
<tr>
<td>
<b>Codice Prodotto</b>
</td>
<td>
<b>Nome Prodotto</b>
</td>
<td>
<b>Quantità </b>
</td>
</tr>
";
while ($ValoriRiga = mysql_fetch_array ($sql_result)) {
$codiceprodotto = $ValoriRiga ["code"];
$quant = $ValoriRiga ["quant"];
print "
<tr>
<td>
$codiceprodotto
</td>
<td>
$nomeprodotto
</td>
<td>
$quant
</td>
</tr>
";
}
print "</table>";
mysql_free_result ($sql_result);
mysql_close ($connection);
?>
</BODY>
</HEAD>
Now, if I make a link like this:
http://localhost/tests/database.php?id=2
nothing happens althought I inserted a field with AUTO_INCREMENT options enabled called id.
It continues to display the same page with all contents in the database.
All replies are accepted.
Thanks
Beppe