Quote:
Originally Posted by toadstool
- if (IN PHP) I call $cart->insert_Pcart($item1, $item2);
-
-
-
-
class Cart
-
{
-
:
-
function insert_Pcart($item_name,$p_qty)
-
{
-
$insert = "INSERT INTO Cart (pname, qty)
-
VALUES ($_POST[$item_name]','$_POST[$p_qty]')";
- Line69=> if (mysql_query($insert, $conn)) { $cartID = mysql_insert_id($conn);
-
-
} else { die ("Error inserting CART FORM data: " .mysql_error()); };
-
-
//$p_name=($_REQUEST["p_name"]);
-
}
I get the error
Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in c:\phpdev\www\project_shopping_cart.php on line 69
Error inserting CART FORM data:
Can anyone explain what this error means or how I might fix it?
It means you're trying to supply a MYSQL-Link resource that isn't valid, that is, your
$conn variable isn't a valid resource. You don't seem to set it anywhere, so why pass it? You can remove this and try again. If no resource is provided, MySQL will take the current (or last opened, I forget) link.