Can someone please tell me why this code returns an error saying the variable $rounds is undefined (returns the error on the last line where the $sql variable is):
// code for retrieving users choices
$currentRound = $POST['currentRound'];
$roundMax = $currentRound-1;
for ($i=1; $i<$roundMax; $i++) {
if ($i != $currentRound) {
$rounds .= 'r'.$i.' AND ';
} else {
$rounds .= 'r'.$i;
}
}
$sql = 'SELECT '.$rounds.' FROM users WHERE user_id = '.$POST['user_id'];
Or is there a better way of doing this? Thanks for any help,
~Oni.