views:

47

answers:

2

Ok let me try this again.

query("CALL getemployee('$eml')"); $result = $sql->fetch_array(); ?> This is my stored procedure:

Delimiter //
Create procedure getemployee(in eml varchar(50))
Begin
  Select * from employees where email = eml;
End//
Delimiter ;

The error i get from browser: "Fatal error: Call to a member function fetch_array() on a non-object ...".

I use phpmyadmin version 3.2.4 and the mysql client version: 5.1.41

+2  A: 

Your CREATE PROCEDURE statement appears to be invalid.

You need to give a name to your procedure, and to the parameter that you are passing. Therefore you may want to try something like the following example:

DELIMITER //
CREATE PROCEDURE procName (IN eml varchar(50))
BEGIN
   SELECT * FROM employees WHERE email = eml;
END//    
DELIMITER ;
Daniel Vassallo
+1  A: 

The eml variable you use is not defined. Should not it be as following:

Create procedure getemployee (in eml varchar(50))
newtover