I have been working on this project for quite a while and still I am stuck on this code. Here’s the page where I can show the product list:
@mysql_connect("localhost", "root", "") or die();
@mysql_select_db("product") or die();
$result=mysql_query("select * from product_list ORDER BY name ASC");
while($row=mysql_fetch_array($result)){
a href="show.php?code=$row['serial']|$row['name']
$row['description']
show.php is:
//connect to server and select database; you may need it
@mysql_connect("localhost", "root", "") or die();
@mysql_select_db("bibendum") or die();
$serial = intval($_GET['serial']);
$query = "SELECT serial, name, desription FROM product_list WHERE serial = {$serial}";
echo "{$row[name]}";
I get this error:
Notice: Undefined index: serial in show.php on line 7
Notice: Undefined index: serial in show.php on line 8
Notice: Use of undefined constant name – assumed ‘name’ in show.php on line 10
Notice: Undefined variable: row in show.php on line 10
I think this:
Should be this:
In the above you assign the query but you will still need to execute the query to get a result.
And this will not work to pass $_GET:
If you are learning DO NOT start by using mysql….. Use mysqli or PDO