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

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
User avatar
raghavan20
DevNet Resident
Posts: 1451
Joined: Sat Jun 11, 2005 6:57 am
Location: London, UK
Contact:

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

Post 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
printf
Forum Contributor
Posts: 173
Joined: Wed Jan 12, 2005 5:24 pm

Post 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!
User avatar
raghavan20
DevNet Resident
Posts: 1451
Joined: Sat Jun 11, 2005 6:57 am
Location: London, UK
Contact:

Post 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 :)
User avatar
raghavan20
DevNet Resident
Posts: 1451
Joined: Sat Jun 11, 2005 6:57 am
Location: London, UK
Contact:

Post 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. :)
Post Reply