// Include config file
include ("includes/config.php");
if (isset($_GET['product_id'])) {
$product_id = $_GET['product_id'];
// Connect and select database
include ("includes/dbconn.php");
// Define query to get product
$query = "SELECT `name`, `short_desc`, `long_desc`, `price`, `image`, `category` FROM products WHERE `product_id`='$product_id'";
// Run the query
$result = mysql_query($query)
or die("<p class=\"error\"><strong>Error: </strong>Could not execute query (\"" . $query . "\"). The error returned was: " . mysql_error() . "</p>\n\n");
// Connect and select database
include ("includes/dbconn.php");
// Define query to get products form categories
$query = "SELECT `product_id`, `name`, `price`, `image` FROM products WHERE `category`='$category' ORDER BY `product_id` DESC LIMIT $offset, $size";
// Run the query
mysql_query($query)
or die("<p class=\"error\"><strong>Error: </strong>Could not execute query (\"" . $query . "\"). The error returned was: " . mysql_error() . "</p>\n\n");
// Define query to get total number of rows
$query = "SELECT COUNT(`prodcut_id`) FROM products WHERE `category`='$category'";
// Run the query
$result = mysql_query($query)
or die("<p class=\"error\"><strong>Error: </strong>Could not execute query (\"" . $query . "\"). The error returned was: " . mysql_error() . "</p>\n\n");
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
I was running a website for a May Ball (a college party that has several thousand people at it). I put a single extra comma into my script and the whole website came crashing down around my ears. Oh well....
__________________
UPDATE 0beron SET talkupation = talkupation + lots WHERE post = 'helpful';
Please login or register to view this content. Registration is FREE (aka MSN handwriting for forums)