Code: Select all
mysql_query("SELECT * FROM `users` WHERE `username` = '$username' AND `password` = '$password' LIMIT 0, 1 ");Second question...
Code: Select all
$query = "SELECT userid,attack FROM stats ORDER BY attack DESC";
$result = mysql_query($query);
$num = mysql_numrows($result);
$i = 0;
while ($i < $num) {
$userid = mysql_result($result,$i,"userid");
$rank = $i + 1;
$query = "UPDATE stats SET attack_rank = '$rank' where userid = '$userid'";
mysql_query($query);
$i++;
}Is it possible to maybe, for each row, as the loop loops round, to add a little update string to an overall update string, which will, once ALL the loop has finished then update the database with a single query. I hope this makes sense. Or is there any other way to do this in a single query.
Thanks for any help
Shears