Hi Everyone, I am new to PDO PHP - I am getting to grips with the insert statements with bind_param.
What I am a bit confused about is how to update a table where id = $var
I have an image upload script that works fine, as it uploads the image to the server location.
What I am trying to do is update the users db table with the location of the image on the server.
Here is my attemp, the strange thing is, Im not seeing any error messages, but the table field is not being update.
Any help would be great.
$dbtype = "mysql"; $dbhost = "dbh"; $dbname = "dbn"; $dbuser = "dbu"; $dbpass = "dbp"; // database connection $conn = new PDO("mysql:host=$dbhost;dbname=$dbname",$dbuser,$dbpass); // new data $img = '$resized_file'; $author = '$authorid'; // query $sql = "UPDATE table SET image=?, WHERE id=?"; $q = $conn->prepare($sql); $q->execute(array($img,$author));