I am doing a shopping cart and have put the products into a mysql database.
The code below displays all the products on one page.
What I want to do is display product type A (3 items) on one page, product type B (4 items) on another page, product type C (2 items) on another page and so on.
What is the best way to go about this?
Thanks for your help.
CODE BELOW>>>>>>>>
include("db.php"
// Get a connection to the database
$cxn = @ConnectToDb($dbServer, $dbUser, $dbPass, $dbName);
$result = mysql_query("select * from items order by itemName asc"
?>
<html>
<head>
<title> Product List </title>
</head>
<body bgcolor="#ffffff">
<h1>Products</h1>
<table width="100%" cellspacing="0" cellpadding="0" border="0">
<tr>
<td width="30%" height="25" bgcolor="red">
<font face="verdana" size="1" color="white">
<b>Product</b>
</font>
</td>
<td width="10%" height="25" bgcolor="red">
<font face="verdana" size="1" color="white">
<b>Price</b>
</font>
</td>
<td width="50%" height="25" bgcolor="red">
<font face="verdana" size="1" color="white">
<b>Description</b>
</font>
</td>
<td width="10%" height="25" bgcolor="red">
<font face="verdana" size="1" color="white">
<b>Add</b>
</font>
</td>
</tr>
<?php
while($row = mysql_fetch_array($result))
{
?>
<tr>
<td width="30%" height="25">
<font face="verdana" size="1" color="black">
<?php echo $row["itemName"]; ?>
</font>
</td>
<td width="10%" height="25">
<font face="verdana" size="1" color="black">
$<?php echo $row["itemPrice"]; ?>
</font>
</td>
<td width="50%" height="25">
<font face="verdana" size="1" color="black">
<?php echo $row["itemDesc"]; ?>
</font>
</td>
<td width="10%" height="25">
<font face="verdana" size="1" color="black">
<a href="cart.php?action=add_item&id=<?php echo $row["itemId"]; ?>&qty=1">Add Item</a>
</font>
</td>
</tr>
<tr>
<td width="100%" colspan="4">
<hr size="1" color="red" NOSHADE>
</td>
</tr>
<?php
}
?>
<tr>
<td width="100%" colspan="4">
<font face="verdana" size="1" color="black">
<a href="cart.php">Your Shopping Cart >></a>
</font>
</td>
</tr>
</table>
</body>
</html>
The code below displays all the products on one page.
What I want to do is display product type A (3 items) on one page, product type B (4 items) on another page, product type C (2 items) on another page and so on.
What is the best way to go about this?
Thanks for your help.
CODE BELOW>>>>>>>>
include("db.php"
// Get a connection to the database
$cxn = @ConnectToDb($dbServer, $dbUser, $dbPass, $dbName);
$result = mysql_query("select * from items order by itemName asc"
?>
<html>
<head>
<title> Product List </title>
</head>
<body bgcolor="#ffffff">
<h1>Products</h1>
<table width="100%" cellspacing="0" cellpadding="0" border="0">
<tr>
<td width="30%" height="25" bgcolor="red">
<font face="verdana" size="1" color="white">
<b>Product</b>
</font>
</td>
<td width="10%" height="25" bgcolor="red">
<font face="verdana" size="1" color="white">
<b>Price</b>
</font>
</td>
<td width="50%" height="25" bgcolor="red">
<font face="verdana" size="1" color="white">
<b>Description</b>
</font>
</td>
<td width="10%" height="25" bgcolor="red">
<font face="verdana" size="1" color="white">
<b>Add</b>
</font>
</td>
</tr>
<?php
while($row = mysql_fetch_array($result))
{
?>
<tr>
<td width="30%" height="25">
<font face="verdana" size="1" color="black">
<?php echo $row["itemName"]; ?>
</font>
</td>
<td width="10%" height="25">
<font face="verdana" size="1" color="black">
$<?php echo $row["itemPrice"]; ?>
</font>
</td>
<td width="50%" height="25">
<font face="verdana" size="1" color="black">
<?php echo $row["itemDesc"]; ?>
</font>
</td>
<td width="10%" height="25">
<font face="verdana" size="1" color="black">
<a href="cart.php?action=add_item&id=<?php echo $row["itemId"]; ?>&qty=1">Add Item</a>
</font>
</td>
</tr>
<tr>
<td width="100%" colspan="4">
<hr size="1" color="red" NOSHADE>
</td>
</tr>
<?php
}
?>
<tr>
<td width="100%" colspan="4">
<font face="verdana" size="1" color="black">
<a href="cart.php">Your Shopping Cart >></a>
</font>
</td>
</tr>
</table>
</body>
</html>