Skip to content
Advertisement

How to use SQL prepared statement in php pdo

I create prepared statement for sql that give me the right result in mysqlWorkbench, but when I tried to use the same query with php pdo, it returns me an empty Array.

So how to use my prepared statement with php pdo ?

This is my code:

JavaScript

Advertisement

Answer

I found a solution that give me the right result.

I create a stored procedure in the database then I call it within php pdo.

JavaScript

// PHP code

JavaScript

This is a link about php preapared statement and stored procedures https://www.php.net/manual/en/pdo.prepared-statements.php

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement