Search the Community
Showing results for tags 'prepared'.
Found 2 results
Hi can someone explain how to create a mysql database in php using OOP prepared statements. I know how to do it with mysqli but I want to know if it can be done with placeholders and oop. a good and clear tut about is okay, but please provide a clear tut about using placeholders and prepared regarding CREATING a new database.
In phpmyadmin I did the following query and had it output in php like this: $sql = "UPDATE `table` SET count = count + 1 WHERE unique_nr = 5175781"; this all worked well. though when I tried to implement it in my script I had an error: script: <?php // code to establish dbase connection: var_dump($unique_nr); // $stmt = $conn->prepare('UPDATE table SET count = ? WHERE unique_nr = ? '); $stmt = $conn->prepare('UPDATE table SET count = count + 1 WHERE unique_nr = ? '); $stmt->bind_param("is", $count, $unique_nr); $stmt->execute(); ?> resulting in an error message. I also tried this way of writing for bind_param: $stmt->bind_param("s", $unique_nr); but that didnt update the column, though there wasnt an error message anymore