[thelist] Include function in CODE doesn't work (blank output)

Jack Timmons jorachim at gmail.com
Sat Feb 14 10:34:03 CST 2009


On Sat, Feb 14, 2009 at 5:22 AM, HP Thniah <heanpeng at gmail.com> wrote:

> Thank you very much for your suggestion. I have posted the code there.
>
>
Of course. I think kasimir-k answered your question, too. If you didn't get
it:

if($rec=mysql_fetch_array
<http://www.php.net/mysql_fetch_array>(mysql_query<http://www.php.net/mysql_query>
("SELECT * FROM cus_info WHERE login='$userid' AND password = '$password'"))
)
{
if(($rec['userid']==$userid)&&($rec['password']==$password))

You're checking the wrong variables. Try putting an else echo "Failed" after


if(($rec['userid']==$userid)&&($rec['password']==$password))

As mentioned, you're being redundant by both querying where user & pass are
equal to the input, and then putting an if statement. Best thing you can do
is check to make sure only one result row was returned (in case there's an
error in your system that allowed multiple accounts of same user/pass).

There's probably more advice to give, but I'm busy playing Fable 2 with the
lady of the house.

-- 
-Jack Timmons
http://www.trotlc.com
Twitter: @jorachim



More information about the thelist mailing list