RE: Update db with $_POST

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thanks for looking,

I figured it out, after RTFM for db, I found that I needed to do field=? instead of using VALUES ().



Example:

$db->query('UPDATE items SET item_name=?, item_desc=?, item_price=?, extraprice=? WHERE item_id = 3',
            array($_POST['title'], $_POST['description'], $_POST['price'], $_POST['extraprice']));






>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']));

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux