Jump to content
Larry Ullman's Book Forums

Trying Stored Precedures For Login


Recommended Posts

This question actually spans two books - this one and "PHP and MySQL for Dynamic Web Sites 4th Edition.

 

I'm using the User Registration in Chapter 18 of the latter and I''m trying to convert it to using Stored Procedures, but things aren't going very well.

 

I created this stored procedure:

DELIMITER $$
CREATE PROCEDURE login()
BEGIN
SELECT * FROM login WHERE email='$email' AND pass=SHA('$pass');
END $$
DELIMITER ;

And this Call:

$r = mysqli_query($dbc, "CALL login('$email', '$pass')");
if (!$r) echo mysqli_error($dbc);
if (mysqli_num_rows($r) > 0)
{

But I'm getting an error message - "Incorrect number of arguments for PROCEDURE login; expected 0, got 2"

 

Is the problem with SHA?

Link to comment
Share on other sites

In phpmyadmin I added these parameters:

IN - email - varchar - 35

IN - pass - varchar - 40

OUT - rid - int - 11

 

Now I get the error message - "Incorrect number of arguments for login; expected 3, got 2".

 

It figures...I'm not able to meet the expectations. I think I better stick with the old procedural coding style. I can get that to work most of the time. :)

Link to comment
Share on other sites

 Share

×
×
  • Create New...