Associate
- Joined
- 15 Feb 2006
- Posts
- 1,872
- Location
- hell
Hi guys
I have another fairly simple question (I guess!).
Basically I've written this statement in PHP:
$finduserid="SELECT player_id from Player WHERE username = '$username'";
$player_id = mysql_query($finduserid);
while( $row = mysql_fetch_array($player_id))
{
echo ($row['player_id'] . "<br />");
}
The problem is I have some username rows in my mySQL table that are blank.
When I loop through and echo out all the player_ids that are found (which should only be one), the query lists all the blank fields too.
Why is mySQL matching against blank fields, if I've specified a username for it to look for in the table?
Many thanks
I have another fairly simple question (I guess!).
Basically I've written this statement in PHP:
$finduserid="SELECT player_id from Player WHERE username = '$username'";
$player_id = mysql_query($finduserid);
while( $row = mysql_fetch_array($player_id))
{
echo ($row['player_id'] . "<br />");
}
The problem is I have some username rows in my mySQL table that are blank.
When I loop through and echo out all the player_ids that are found (which should only be one), the query lists all the blank fields too.
Why is mySQL matching against blank fields, if I've specified a username for it to look for in the table?
Many thanks