+ 2

how to run multiple prepared statement in one script using pdo mysql??

Php Pdo mysql

7th Apr 2018, 3:35 AM
mike cruz
1 Answer
+ 5
You can combine multiple statements separated by semicolon; in a single $sql = " delete from user; insert into user (username, password) values ('johndoe', '1234'); "; $stmt = $db->prepare($sql); $stmt->execute(); Be sure to using proper encoding on data when used with execute command to prevent issues with SQL injection.
7th Apr 2018, 5:41 AM
David Carroll
David Carroll - avatar