Wednesday 15 September 2010

android - DELETE rows with prepared query in PHP and MySQL -



android - DELETE rows with prepared query in PHP and MySQL -

this code webservice of android application, party of code wrote delete row defined multiple parameter id , receiver method have message database error. couldn't delete post! what's solution please sorry poor english language

<?php //load , connect mysql database stuff require("config.inc.php"); //initial query $query = 'delete messages id =? , receiver =?'; $query_params = array($_get['id'], $_get['receiver']); //execute query seek { $stmt = $db->prepare($query); $result = $stmt->execute($query_params); $response["success"] = 1; $response["message"] = "post deleted!"; echo json_encode($response); } grab (pdoexception $ex) { $response["success"] = 0; $response["message"] = "database error. couldn't delete post!"; die(json_encode($response)); } ?>

you have prepared parameters statement, never utilize them statement.

try changing:

$result = $stmt->execute(array());

to:

$result = $stmt->execute($query_params);

php android mysql json

No comments:

Post a Comment