I'm having a problem with a form to upload product details and images to a database. The form is displaying properly. When I try to submit information I get the following warning.
Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in
C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\folder\admin\add_penda nt.php on line
124
When I put the query on line 124 into phpmyadmin I had a message saying syntax error. I thought maybe I should have put a semicolon after ($dbc, $query)) but that resulted in a blank page instead of the form.
I have spent all afternoon and evening on this problem, I hope somebody can help me.
This is the php code including the preceding and following lines
PHP Code:
if ($g && $sh && $s && $i && $d && $p && $ns && $wp && $pc) { // If everything's OK.
// Add pendant to the database.
$query = "INSERT INTO penants (pendant_id, gemstone, shape, size, image, description, price,
no_in_stock, weight_of_pendant, postage_costs) VALUES ($a, '$g', $sh, '$s', '$i', '&d', '&p' '$ns', '$wp', '$pc')";
//Line 124 follows
if ($result = mysql_query ($dbc, $query)) { // Worked.
echo '<p>The pendant has been added.</p>';
} else { // If the query did not run OK.
echo '<p><font color="red">Your submission could not be processed due to a system error.</font></p>';
}
} else { // Failed a test.
echo '<p><font color="red">Please click "back" and try again.</font></p>';
}