Sunday, 15 September 2013

php - pdo query not running -



php - pdo query not running -

i can't seem figure out why query isn't running

if ( $productname && $productdescription && $productprice ) { // sql // update `prostud_tristurion`.`products` set `product_title` = 'ajax test', `product_description` = 'was certainty remaining engrossed applauded sir how discovery.', `product_price` = '524' `products`.`product_id` = 10; seek { $query = "update products set product_title = :pname, product_description = :pdescription, product_price = :pprice, product_id = :pid"; //prepare query excecution $stmt = $con->prepare($query); //bind parameters $stmt->bindparam(':pid', $id); $stmt->bindparam(':pname', $productname); $stmt->bindparam(':pdescription', $productdescription); $stmt->bindparam(':pprice', $productprice); // echo "$productprice / $productdescription / $productname / $id\n $stmt"; var_dump($_post); // execute query if ($stmt->execute() ) { echo "record updated."; } else { die('unable update record.'); } }catch(pdoexception $exception){ //to handle error echo "error: " . $exception->getmessage(); } }

all unable update record.

var_dump($_post);

is looking good

you have errant comma @ product_price = :pprice, where

if code reaches die statement have exceptions turned off (not recommended) can error message database (to log or echo) $stmt->errorinfo()

php mysql pdo

No comments:

Post a Comment