fetch_array (); ? > T...">

Mysql stored procedure where clause

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 the browser is: "Fatal error: calling the fetch_array () member function for a non-object ...".

I am using phpmyadmin version 3.2.4 and mysql client version: 5.1.41

+3
source share
3 answers

Your operator CREATE PROCEDUREappears to be invalid.

You need to specify the name of your procedure and the parameter that you pass. So you can try something like the following example:

DELIMITER //
CREATE PROCEDURE procName (IN eml varchar(50))
BEGIN
   SELECT * FROM employees WHERE email = eml;
END//    
DELIMITER ;
+2

eml . :

Create procedure getemployee (in eml varchar(50))
+1
CREATE PROCEDURE get_customers(IN inCustomerIdList VARCHAR(100))
BEGIN

  SELECT first_name, last_name, email FROM tbl_customers  
  WHERE customer_id IN (inCustomerIdList);

END$$
0
source

Source: https://habr.com/ru/post/1741512/


All Articles