<?php
include_once"scripts/connect.php";
$sql = mysql_query("SELECT * FROM Tabletest ORDER BY Points DESC, PP DESC, Name ASC");
$pos=1;
while($pos <= 16){
$row = mysql_fetch_array($sql);
$Points = $row['Points'];
$PP = $row['PP'];
$Name = $row['Name'];
mysql_query("UPDATE Tabletest SET thiswp=".$pos." WHERE Points=".$Points." PP=".$PP." Name=".$Name."");
echo "$pos $Points $Name $PP <br/> \n";
$pos = $pos + 1;
}
?>
This echoes out as I would expect i.e.
Position Points Name PP
1 5 John 55
2 4 Bob 54
3 4 Jane 54
4 3 Rob 50
etc
But it doesn’t update Tabletest – the thiswp field is left blank. Where have I messed up?
Cheers
Rich
You missed out
AND.Edit: Also, just in case Name was a string, it should have had ‘single quotes’ around it and have been escaped, as above. Same goes for anything else that was a string.