im trying to execute an UPDATE query in Mysqli OOP. I know there are many tutorials in google but nothing worked for me :( I will appreciate if someone could write a simple code with a simple query example that will include all neccesery steps begining with creating a connection object.
this is my code, i tried to echo some things to try to find a problem. outputs are OK except the line "echo "test2"; that echo and the code below are not executed..
<?php if ((isset($_POST['title'])) && (isset($_POST['post']))) { $title= $_POST['title']; $post= $_POST['post']; $date = date("d-m-Y H:i"); //UPDATE post echo $title, $post, $_SESSION['rec_id']; $stmt = $connection->query("UPDATE blog_post SET title=? AND post=? WHERE id=?"); echo 'test1'; $stmt->bind_param("ssi", $title , $post, $_SESSION['rec_id']); echo 'test2'; printf("Affected rows (UPDATE): %d\n", $connection->affected_rows); } ?>