When PHPmysql_query () is executed, the following error occurs:
$ Data = mysql_query ("call db. Query ('11','s ')");
If (! $ Data ){
Dump (mysql_error ());
}
This query method is normal, no problem!
Method 2:
$ Data = mysql_query ("SET @ A = '11', @ B = 's'; call db. Query (@ A, @ B );");
If (! $ Data ){
Dump (mysql_error ());
}
In this way, an error is reported.
"You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Call bi. gm_queryRoleLoginLogOutLog (@ A, @ B); 'at line 1"
I want to know the reason. it's troublesome.
Reply to discussion (solution)
SET @ A = '11', @ B = 's'; this is the method used in the stored procedure,
In mysql_query, you can write simple SQL statements.
@ Tata8181
This method is okay when you call the stored procedure to write SQL statements.
Mysql_query can only execute one command at a time
Use mysqli_multi_query instead.
Thanks to the moderator