Could anybody tell me why the following piece of code will work fine when written to the page that contains my connect statement, but when I put it in an included function file it won't work?
I expect I'm doing something basic wrong. Cheers.
Code:
$query="select * from users
where username = '$username'
and passwd = password('$password')";
$result=mysql_query($query);
if(!$result)
{
echo 'Could not make query';
exit;
}
if(mysql_num_rows($result)>0)
{
echo 'welcome back';
exit;
}
else
echo 'username and password are not correct';
I expect I'm doing something basic wrong. Cheers.