Php and MSQL simple mixup problem.... help!
Posted: Thu Jul 06, 2006 2:42 pm
Ok, so I'm trying to run a query that finds the scores from a particular game for a particular user.
This code returns a single value when searching only by the particular game:
This code returns a single value when searching by the particular user:
But, this code returns no values when I run a query for both at the same time:
Whats going on?
This code returns a single value when searching only by the particular game:
Code: Select all
$sql4="SELECT * FROM `arcade_highscores` WHERE `gamename` = '$gameid' ORDER BY `score` DESC LIMIT 1";
$result4=mysql_query($sql4);
$row4 = mysql_fetch_array($result4);
$scorenum = mysql_num_rows($result4);
echo "$scorenum";
if($scorenum == 1){
$yourscore = $row4["score"];
}
else {
$yourscore = "None";
}Code: Select all
$sql4="SELECT * FROM `arcade_highscores` WHERE `user` = '$user' ORDER BY `score` DESC LIMIT 1";
$result4=mysql_query($sql4);
$row4 = mysql_fetch_array($result4);
$scorenum = mysql_num_rows($result4);
echo "$scorenum";
if($scorenum == 1){
$yourscore = $row4["score"];
}
else {
$yourscore = "None";
}Code: Select all
$sql4="SELECT * FROM `arcade_highscores` WHERE `gamename` = '$gameid', `user` = '$user' ORDER BY `score` DESC LIMIT 1";
$result4=mysql_query($sql4);
$row4 = mysql_fetch_array($result4);
$scorenum = mysql_num_rows($result4);
echo "$scorenum";
if($scorenum == 1){
$yourscore = $row4["score"];
}
else {
$yourscore = "None";
}