i wnat to validate if the numbers entered into a form are similar to the once in the database but i keep on getting this error
Parse error: syntax error, unexpected T_IF in /var/www/intranet.sita.co.za/quiz/quizsubmit1.php on line 60
below is my code
<?php
//First lets get the username and password from the user
$q1=$_POST["q1"];
$q2=$_POST["q2"];
$q3=$_POST["q3"];
$q4=$_POST["q4"];
$q5=$_POST["q5"];
$q6=$_POST["q6"];
$q7=$_POST["q7"];
$q8=$_POST["q8"];
$q9=$_POST["q9"];
$q10=$_POST["q10"];
$q11=$_POST["q11"];
$q12=$_POST["q22"];
require "../conn.php";
$con = getConn();
if(!$con)
die ("Error Connecting to mysql");
else
{
/*echo "Successfully connected to mysql";*/
mysql_select_db($db);
$data = "SELECT * FROM d2squiz;";
$data = mysql_query($data);
$row = mysql_fetch_assoc($data);
$sql1=mysql_query("SELECT $q1,$q2,$q3,$q4,$q5,$q6,$q7,$q8,$q9,$q10,$q11,$q12 password FROM d2squiz WHERE $q1='q1'and $q2='q2'and $q3='q3'and $q4='q4'and $q5='q5'and $q6='q6'and $q7='q7'and $q8='q8'and $q9='q9'and $q10and ='q10'$q11='q11'and $q12='q12'")
if (mysql_num_rows($sql1)==0 || mysql_num_rows($sql1)>1)
{ echo "quiz answers provided are not valid, please fill in the quiz again";
}
if(mysql_num_rows($sql1)==1)
{
include("thankyou.html"); //open up the secure page //instead of "the webpage" type in the path your secure website is located in
mysql_close($con);
quiz
Moderator: General Moderators
- aceconcepts
- DevNet Resident
- Posts: 1424
- Joined: Mon Feb 06, 2006 11:26 am
- Location: London
Re: quiz
You haven't opened/closed some of you IF statements - some require "{" and/or "}"
Re: quiz
That's true, but it's not the immediate problem. The immediate problem is that the mysql_query() line has no semicolon on the end.
Also, if you use the forum's code tag, then we have some chance of actually seeing where line 60 is.
Also, if you use the forum's code tag, then we have some chance of actually seeing where line 60 is.