Hello all,
I\'m new here and hope that someone has the answer of a real beginner.
I\'ve read several tutorials but what i want isn\'t working.
I have a little table with some fields:
CREATE TABLE prod (
name varchar(100) NOT NULL default \"\",
nr int(5) NOT NULL,
descr text NOT NULL,
PRIMARY KEY (nr),
UNIQUE KEY nr (nr),
UNIQUE KEY name (name)
) TYPE=MyISAM COMMENT=\"Products\";
I have a working php program to add data to the database.
I also have a little php program to list all records in the database.
Now i need a program that can be called with a parameter to show all fields of a product like:
http://localhost/pdc/listprod.php?prodnr=3
My program looks like this:
<?
include \'db.php\';
?>
<html>
<head>
<title>Products/title>
</head>
<body bgcolor=\"#ffffff\" >
<?
# setup SQL statement
$sql = \" SELECT * FROM prod WHERE nr = \'$prodnr\'\";
# execute SQL statement
$rs = mysql_query($sql, $cid);
if (mysql_error()) { print \"Database Error: $sql \" . mysql_error(); }
# display results
print \"<p><b>Products</b><p>n\";
print \"<table border=0>\";
while ($row = mysql_fetch_array($rs))
{
$name = $row[\"name\"];
$nr = $row[\"nr\"];
$descr = $row[\"descr\"];
print \"<tr><td>$name</td><td>$nr</td><td>$descr</td><tr>\";
}
print \"</table>\";
?>
</body>
</html>
But, i get NO results! I\'ve made shure product nr 3 is in the database, i\'ve checked it with PHPMYADMIN.
What am i doing wrone here? Can anybody point me in the right direction?
Thanks in advace,
Webguy