php website accessing sql problem?

pete20r2

New member
<?php
echo("<P>" . $_GET['Submit1'] . "</P>");
if (isset($_GET['Submit1'])) {
echo("<P>" . $_GET['product'] . "</P>");
$product = $_GET['product'];
$result = mysql_query("SELECT * FROM stock");
echo("<P>" . $result . "</P>");
while ( $row = mysql_fetch_array($result, MYSQL_BOTH) ) {
echo("<P>" . $row["price"] . "</P>");
echo("<P>" . $row["description"] . "</P>");
echo("<P>" . $row["status"] . "</P>");
}
}


the database exists and has 1 row in it but I get this when I run this section of code:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/a3168966/public_html/products.php on line 67

line 67 is:
while ( $row = mysql_fetch_array($result, MYSQL_BOTH) ) {

I put an asterix in the query to try and get a result so i know the top half does nothing atm.

echo("<P>" . $result . "</P>"); <<< was an attempt at debugging, nothing was returned!
?>
http://pastebin.com/uLkDuqui for full code
 
Back
Top