Location: PHPKode > scripts > shopcart > shopcart/includes/classes/Site2.php
<?php
class Site
{	
	public function ListProducts()
	{
		$sql="select productName,productCode,productPrice from products;";
		$query=mysql_query($sql);
		
		echo '<table>';
		echo 	'<thead>';
		echo		'<tr>';
		echo 			'<th>Product Name</th>';
		echo 			'<th>Product Code</th>';
		echo 			'<th>Product Price</th>';
		echo 			'<th>Purchase</th>';						
		echo 		'</tr>';	
		echo 	'</thead>';
		echo 	'<tbody>';
		
		while($row=mysql_fetch_row($query))
		{
			echo '<tr>';
			echo 	'<td>'.$row[0].'</td>';
			echo 	'<td>'.$row[1].'</td>';
			echo 	'<td>'.$row[2].'</td>';
			echo 	'<td><a href="Cart.php?add='.$row[1].'">Add to Cart</a></td>';
			echo '</tr>';
		}
		
		echo	'</tbody>';
		echo '</table>';
	}

}
?>
Return current item: shopcart