Page 1 of 1

how do I know whether a procedure is called from PHP??

Posted: Wed Apr 12, 2006 1:46 pm
by raghavan20
I have a procedure declared and I am making a call from PHP but I am not sure whether it is working but the query generated from PHP when run directly from Mysql client or any other Mysql tool works properly, I suspect the procedure is not called... Can anyone point me whether I am doing anything wrong or there is any method available to know whether a procedure is called???

Code: Select all

mysql call:

call SavedItemsToShoppingCartLines(55);
+------------+------------------------+
| m_quantity | m_doesProductExistInSC |
+------------+------------------------+
|          1 | NULL                   |
+------------+------------------------+
1 row in set

Code: Select all

$query = "call SavedItemsToShoppingCartLines({$User->getObjID()});";
				echo $query;
				$result = $conn->query($query);
				if ($result){
					//echo "valid result returned";
				}
				echo $conn->affected_rows;

Code: Select all

output of above php code: 

call SavedItemsToShoppingCartLines(55);-1

Posted: Wed Apr 12, 2006 11:08 pm
by printf
You can't do it with mysql_, you need mysqli_! The mysql_ client doesn't support triggers, rollbacks or the calling of any MySqlSpp! Some good examples are here, (database, Spp,) for Perl, PHP, .NET The examples in CH (05,06,09) should show you how to do what you want with mysqli_! Sorry I don't know what your Spp does (in/out) so I can't give a detailed example!

pif!

Posted: Thu Apr 13, 2006 1:51 am
by raghavan20
thanks for the link to load of examples..
but if you had made a wild guess from my snippet in PHP in my earlier post, you could have recognized that I am using mysqli. :wink:

okie, do you know how to find whether a procedure is called from PHP? Please do not hesitate to provide more examples or link to examples :)

Posted: Thu Apr 13, 2006 4:58 am
by raghavan20
can anyone confirm me that is it possible to call procedures from mysqli or I have to install PDO??? I am getting frustrated of searching in the Internet as I could not find any article that talks about procedure calls from PHP. :(

EDIT: problem solved, I was connected to a different database where the procedure is not. :)