PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
// If the user did better this time, record the better grade.
if ($mygradeї0] < $score)
$result = mysql_query("UPDATE userquizlesson SET grade = '$score' where name = '$name' and pword = '$pword' and lessonnumber = '$lesson' and quiznumber = '$quiz'", $link_id);
// If the user made >= 75 for the first time, mark them as passing, and let them take the next lesson.
if ($score >= 75 && $mygradeї0] < 75)
{
// update lessonnumber or quiznumber.
$result = mysql_query("SELECT quiznumber from lessonquiz where lessonnumber = '$lesson"', $link_id);
$num_quizzes = mysql_num_rows($result);
// if this is the last quiz in the lesson, increment the lessonnumber
if ($quiz == $num_quizzes)
{
//will have to add check later to see if its the final lesson.
$lesson = $lesson + 1;
$result = mysql_query("UPDATE userquizlesson SET lessonnumber = '$lesson' where name = '$name' and pword = '$pword'", $link_id);
}
// else increment the quiznumber
else
{
$quiz++;
$result = mysql_query("UPDATE userquizlesson SET quiznumber = '$quiz' where name = '$name' and pword = '$pword'", $link_id);
}
}
Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING in c:\webpages\dbaccess.inc on line 163
Line 163 is the sql query inside the if ($quiz == $num_quizzes) block
take a deep look here, and see that the string there starts with " quotes and ends prematurely at $lesson" and after that there's another quote ('), fix that and problem solved
Paddy wrote:Get yourself a teddy bear and explain your code to it. You are bound to see the problem then.
This really made me laugh - it's a fantastic idea.
Mac
Yeah, it was actually taught to us by a lecturer. Saves the humiliation of asking a human cos as soon as you start explaining what you are trying to do to someone you see the error of your ways. Teddy bears don't laugh at you. Coffee mugs work as well.