Forum Moderators: coopster
<?php
error_reporting(0);
?>
<html>
<head>
</head>
<body>
<?php
$usr = "root";
$pwd = "";
$db = "mymarket";
$host = "localhost";
//connect to database
$cid = mysql_connect($host,$usr,$pwd);
if (!$cid) { echo("ERROR: " . mysql_error() . "\n");}
else
// setup SQL statement
$SQL = " SELECT * FROM categories ";
// execute SQL statement
$retid = mysql_db_query($db, $SQL, $cid);
// check for errors
if (!$retid) { echo( mysql_error()); }
else {
?>
<?php
// display results
while ($row = mysql_fetch_array($retid)) {
$name = $row["name"];
$id = $row['id'];
echo ("<dd><a href=category1.php?id=\"$id\">$name</a></dd>\n<br>");
}
echo ("</dt></p>");
}
?>
</body>
</html>
<?php
error_reporting(0);
?>
<html>
<head>
</head>
<body>
<?php
$usr = "root";
$pwd = "";
$db = "mymarket";
$host = "localhost";
//connect to database
$cid = mysql_connect($host,$usr,$pwd);
if (!$cid) { echo("ERROR: " . mysql_error() . "\n");}
$category = "";
// setup SQL statement
$SQL = " SELECT * FROM products ";
?>
<?php
// execute SQL statement
$retid = mysql_db_query($db, $SQL, $cid);
// check for errors
if (!$retid) { echo( mysql_error()); }
else {
// display results
echo ("<p><dt><b>$category</b><br>\n");
while ($row = mysql_fetch_array($retid)) {
$description = $row["description"];
$id = $row["id"];
$name = $row["name"];
echo ("<dd><a href=phones2.php?id=\"$id\">$name</a></dd>\n<br>");
}
echo ("</dt></p>");
}
?>
<?php
error_reporting(0);
?>
<html>
<head>
</head>
<body>
<?php
$usr = "root";
$pwd = "";
$db = "mymarket";
$host = "localhost";
//connect to database
$cid = mysql_connect($host,$usr,$pwd);
if (!$cid) { echo("ERROR: " . mysql_error() . "\n");}
// setup SQL statement
$id=$_GET['id'];
$SQL = "SELECT * FROM products ";
?>
<?php
// execute SQL statement
$retid = mysql_query($db, $SQL, $cid);
// display results
echo "<p><dt><b>$id</b><br>\n";
echo "<p><dt><b>$name</b><br>\n";
while ($row = mysql_fetch_object($retid)) {
$name = $row->name;
$description = $row->description;
$price = $row->price;
echo ("<dd>$name</dd>\n<br>$description<br>$price");
}
echo ("</dt></p>");
?>
</body>
</html>