Re: Update db with $_POST

From: Date: Wed, 16 Mar 2005 06:50:16 +0000
Subject: Re: Update db with $_POST
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-210880@lists.php.net to get a copy of this message
assuming you are using PEAR DB - $result =& $db->query("UPDATE items SET (item_name, item_desc, item_price, extraprice) VALUES (?,?,?,?) WHERE item_id = 3", array($_POST['title'], $_POST['description'], $_POST['price'], $_POST['extraprice'])); if (PEAR::isError($result)) { echo "Error: There was an error with the query. Message returned: "; die($result->getMessage().' '.$db->getUserInfo().' ')); } Should give you some info to tell you what is wrong. Danny Brow wrote:
I'm trying to update some form data with this db update query and it's not working, I'm not getting an error either. $db->query("UPDATE items SET item_name = $_POST[title], item_desc = $_POST[description], item_price = $_POST[price], extraprice = $_POST[extraprice] WHERE item_id = 3"); & I've tried this: $db->query("UPDATE items SET (item_name, item_desc, item_price, extraprice)
       VALUES (?,?,?,?) WHERE item_id = 3",
       array($_POST['title'], $_POST['description'], $_POST['price'],
$_POST['extraprice'])); Thanks, Dan.
-- Respectfully, Ligaya Turmelle "Life is a game.... so have fun"

« previous php.general (#210880) next »