Help me

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Locked
wugang_bob
Forum Newbie
Posts: 6
Joined: Thu Jun 26, 2003 8:20 pm

Help me

Post by wugang_bob »

$query = "select * from userid where username=".$_REQUEST['username'];
$result=mysql_db_query($query);
if(mysql_num_rows($result)==1)
{
header("Location: fail3.php");
exit;
}

Execute the above code, no error message, but it seem does not work.

Thank you
User avatar
Wayne
Forum Contributor
Posts: 339
Joined: Wed Jun 05, 2002 10:59 am

Post by Wayne »

Code: Select all

$query = "select * from userid where username=".$_REQUESTї'username'];
needs to be :

Code: Select all

$query = "select * from userid where username='" .$_REQUESTї'username'] ."'";
you may also want to put in a else statement.
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

Do not cross post please:
viewtopic.php?t=10187

Mac
Locked