I am making a questionnaire that records peoples results, here is my code:
if ($question1=="Rees Andrew McIvor" || $question1=="rees andrew mcivor" || $question1=="Rees Andrew Mcivor") {
echo "<tr><td><strong>Question 2: </strong>Well done!! Correct Answer</td></tr>" &&
$sql = "INSERT INTO logic_questionnaire SET
name ='$name',
answers ='1 out of 11'";
} else {
echo "<tr><td><strong>Question 1: </strong>Sorry Wrong Answer</td></tr>" &&
$sql = "INSERT INTO logic_questionnaire SET
name ='$name',
answers ='0 out of 11'";
}
Can you see from the code why it aint inserting the information?
Thanks
Can anybody help?
What's the && for? I wouldn't have those there, just a semicolon.
I assume the mysql_query($sql) statement is elsewhere?
What's the error message?
Can anybody help?
I have no errors, I aint included the mysql_query($sql) statment, I have used it before. But I dont konw how to go about it. Could you help?
Can anybody help?
You need something like:
$link = mysql_connect("localhost", $user, $password) or die("Could not connect to server"); mysql_select_db($database) or die("Could not select database \"".$database."\" - ".mysql_error());
to initialise the link to the MySQL server.
Then you can run as many mysql_query($sql)'s as you like.
Yeah I understand
Yeah I understand that.. I get no errors, sorry I didnt state that at the start.. I have all the conection details <?php include('db_connect.php'); ?>
Can u see any other errors
Thanks
Can anybody help?
No, can't see anything else blatently wrong.