Prepared SQL Statement in PHP Not Updating MySQL Database Row -


i attempting update mysql database table new rows php script. script called frontend html form gets seralised , passed php $_post variables.

    $stmt = $con->prepare("update blog set tag = ?, datestamp = ?, title = ?, content = ?, views = ?, shares = ? id=?");     $stmt->bind_param("ssssiii", $tag, $datestamp, $title, $content, $views, $shares, $postid);     $stmt->execute();      / check whether execute() succeeded      if ($stmt->errno) {         echo "failure! " . $stmt->error;     }     else {         echo var_dump($stmt);         printf("%d row updated.\n", $stmt->affected_rows);      } 

the request not throw error, database row not updated, , outputs "0 rows updated". serialised data being sent right types (strings , ints appropriate). know might causing issue?

echo var_dump($stmt) returns :

object(mysqli_stmt)#2 (9) { ["affected_rows"]=> int(0) ["insert_id"]=> int(0) ["num_rows"]=> int(0) ["param_count"]=> int(7) ["field_count"]=> int(0) ["errno"]=> int(0) ["error"]=> string(0) "" ["sqlstate"]=> string(5) "00000" ["id"]=> int(1) } 

your code looks fine, double check $postid , if matches record id in blog table.

also make sure using correct database (check connection details).

side note: not use echo var_dump(), var_dump() echo it.


Comments

Popular posts from this blog

matlab - error with cyclic autocorrelation function -

django - (fields.E300) Field defines a relation with model 'AbstractEmailUser' which is either not installed, or is abstract -

c# - What is a good .Net RefEdit control to use with ExcelDna? -