s_ainley87 Posted March 14, 2008 Share Posted March 14, 2008 Hello Everyone, I am currently trying to make a product catalog and it is not going very well, this is my attempt at the code <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Browse Products</title> <? require_once('include/mysql_connect.php'); ?> </head> <body> <? // Are we looking at a particular artist? if (isset($_GET['cid'])) { $aid = (int) $_GET['cid']; if ($aid > 0) { $query = "SELECT artists.category_id, product_name, product_price, produst_desc, product_id FROM category, product WHERE category.cateogory_id = product.category_id AND product.category_id =$cid ORDER BY product.product_name"; } else { $query = "SELECT category.category_id, product_name, product_price, product_desc, product_id FROM category, products WHERE category.category_id = product.category_id ORDER BY category.category_name ASC, product.product_name ASC"; } } else { $query = "SELECT category.category_id, product_name, product_price, product_desc, product_id FROM category, products WHERE category.category_id = product.category_id ORDER BY category.category_name ASC, products.products_name ASC"; } // Create the table head. echo '<table border="0" width="90%" cellspacing="3" cellpadding="3" align="center"> <tr> <td align="left" width="20%"><b>Category</b></td> <td align="left" width="20%"><b>Product Name</b></td> <td align="left" width="40%"><b>Description</b></td> <td align="right" width="20%"><b>Price</b></td> </tr>'; // Display all the prints, linked to URLs. $result = mysqli_query ($dbc, $query); while ($row = mysqli_fetch_array ($result) { // Display each record. echo " <tr> <td align=\"left\"><a href='browse_prints.php?cid={$row['category_id']}'>{$row['category_name']}</a></td> <td align=\"left\"><a href=\"view_print.php?pid={$row['product_id']}\">{$row['product_name']}</td> <td align=\"left\">{$row['product_desc']}</td> <td align=\"right\">\${$row['product_price']}</td> </tr>\n"; } // End of while loop. echo '</table>'; // Close the table. mysqli_close($dbc); // Close the database connection. ?> </body> </html> At the moment the page shows all the queries and no product, it is also show the links as the $row[whatever] rather than a product name etc. Any ideas on what is wrong with it, or can some point me in the direction of a tutorial that is easy to follow? Quote Link to comment Share on other sites More sharing options...
johnska7 Posted March 14, 2008 Share Posted March 14, 2008 Sounds like PHP isn't executing... are you sure that it is installed and active on your server? Quote Link to comment Share on other sites More sharing options...
s_ainley87 Posted March 14, 2008 Author Share Posted March 14, 2008 absolutley posistive as i have just finished uploading all the data to my Mysql tables using PHP pages. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.