Jump to content
Larry Ullman's Book Forums
Sign in to follow this  
DavidP

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?

Share this post


Link to post
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. :)

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...