Jump to content

mySQL - stored procedures


knot13yet

Recommended Posts

Man, this seemed easy when I started it.

OK.,. so I made a simple procedure on a virtual server:

something like

DELIMITER //

CREATE PROCEDURE GetAllProducts()

BEGIN

SELECT *  FROM products;

END //

DELIMITER ;

 

It failed in phpMyAdmin, research said this was common.. ok So I tried it in Workbench.. failed with a security error. ... not a big deal... Tried it with HeidiSQL.. "Passed" .. cool the procedure works. So lets put it into a PHP file.

 

empty...

 

no error... just no return.

 

$sql = 'call GetAllProducts';

$result = $db->query($sql); // call to data class

while($row = $db->getAsoc)

{

print_r($row);

}

 

the data class is sound.. works every time... I think........

 

:shrug:

 

Link to comment
https://forums.phpfreaks.com/topic/242613-mysql-stored-procedures/
Share on other sites

did you try

call GetAllProducts

at PhpMyAdmin (or any other client)?

 

What did it output?

 

If it outputs as expected, then your PHP library is problematic.

 

If it does not output as expected, then maybe both the mysql client program and/or PHP library your are using is problematic.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.