Password() function problem
Posted by: ali (---.static.telcel.net.ve)
Date: June 06, 2006 07:13PM

The problem is that qhen i do an sql querie like this "SELECT * FROM user WHERE name = $usrName and pwd = password('$password')" in phpmyadmin i get this message "MySQL returned an empty result set (i.e. zero rows)."

I don't know what's wrong.

Thanks in advance!

Options: ReplyQuote
Re: Password() function problem
Posted by: CyberSpatium (67.170.181.---)
Date: June 07, 2006 05:23AM

you have a php syntax error. You wrote:
"SELECT * FROM user WHERE name = $usrName and pwd = password('$password')"

Change to:
"SELECT * FROM user WHERE name = $usrName and pwd = $password('password')"



Post Edited (06-07-06 05:24)

CyberSpatium
----------------------
WAMP Forum Admin

Web Development for Newbie's Blog - Check out my new blog. It is for web developers, and especially tailored for the web development newbie. If you are not fluent in “geek speak”, then this incredible resource is just you. And even if you are a web development pro, this is a great resource to check out some of the latest web development tips, news, tutorials, codes and more.

Options: ReplyQuote
Re: Password() function problem
Posted by: k776 (---.bliink.ihug.co.nz)
Date: June 07, 2006 05:27AM

That probably wont work either. I generally use:

mysql_query("SELECT * FROM user WHERE name='".$usrName."' AND pwd='".password('password')."'"winking smiley;



Post Edited (06-07-06 05:28)

Options: ReplyQuote
Re: Password() function problem
Posted by: CyberSpatium (67.170.181.---)
Date: June 07, 2006 01:08PM

just a note to somone who tries to use the above code, it too has a syntax error... change:
mysql_query("SELECT * FROM user WHERE name='".$usrName."' AND pwd='".password('password')."'"winking smiley;

to
mysql_query("SELECT * FROM user WHERE name='".$usrName."' AND pwd='".$password('password')."'"winking smiley;

Options: ReplyQuote
Re: Password() function problem
Posted by: ali (---.static.telcel.net.ve)
Date: June 07, 2006 01:16PM

That code has a syntax error too.

I've tried this code in php:

<?php
$sql = "SELECT * FROM user WHERE name = " .$userName. " and pwd = password('" .$userPwd. "')";
$result = mysql_query($sql);
?>

and i don't get a result.

Options: ReplyQuote
Re: Password() function problem
Posted by: CyberSpatium (67.170.181.---)
Date: June 07, 2006 01:25PM

everyone keeps using the same incorrect syntax. you all keep using:
password('password')

and I keep saying change it to:
$password('password')


Here is the correct syntax to use for your php code:

<?php

$sql = "SELECT * FROM user WHERE name = " . $userName . " AND pwd = " . $password('password') . "";

$result = mysql_query($sql);

?>



Post Edited (06-07-06 13:25)

CyberSpatium
----------------------
WAMP Forum Admin

Web Development for Newbie's Blog - Check out my new blog. It is for web developers, and especially tailored for the web development newbie. If you are not fluent in “geek speak”, then this incredible resource is just you. And even if you are a web development pro, this is a great resource to check out some of the latest web development tips, news, tutorials, codes and more.

Options: ReplyQuote
Re: Password() function problem
Posted by: ali (---.static.telcel.net.ve)
Date: June 07, 2006 01:49PM

When i use the code above i get this message: "Parse error: parse error, unexpected T_STRING"

I don't understand why you say that the rigt way is "$password".

Options: ReplyQuote
Re: Password() function problem
Posted by: k776 (---.bliink.ihug.co.nz)
Date: June 07, 2006 10:44PM

password() is a function, not a varible hence hving a $ in front of it will cause troubles. Try this instead.

$usrPass = password("password"winking smiley;
mysql_query("SELECT * FROM user WHERE name='".$usrName."' AND pwd='".$usrPass."'"winking smiley;

Options: ReplyQuote
Re: Password() function problem
Posted by: CyberSpatium (67.170.181.---)
Date: June 08, 2006 04:35AM

php does not have a password() function.

Options: ReplyQuote
Re: Password() function problem
Posted by: k776 (---.bliink.ihug.co.nz)
Date: June 08, 2006 06:45AM

But mysql does tongue sticking out smiley And he could have probably made his own function like:

function password($pass)
{
return md5($pass);
}

or something more complex.



Post Edited (06-09-06 01:21)

Options: ReplyQuote


Sorry, only registered users may post in this forum.