I am wondering what I am doing wrong. I'm trying to add to one table and at the same time update another table. It'll add to a table with no problems but it won't update the other table. Here's the code and thanks in advance.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<title>Crushed</title>
<style type="text/css">
input#YES {
margin-left: 545px;
background-color: #FF0000;
}
input#MAYBE {
margin-left: 5px;
background-color: #FF0000;
}
input#NO {
margin-left: 5px;
background-color: #FF0000;
}
</style>
</head>
<body>
<?php
$user="*";
$password="*";
$database="*";
$connection=mysql_connect('localhost',$user,$password);
@mysql_select_db($database) or die( "Unable to select database");
$query="SELECT `question`, `question` FROM `questions` ORDER by rand() LIMIT 1";
$result=mysql_query($query) or die(mysql_error());
$QID = htmlentities(mysql_result($result,$i,"QID"));
$question = htmlentities(mysql_result($result,$i,"question"));
echo("<blockquote>" . $QID . " <center>" . $question . "</center></blockquote>");
?>
<form method="post">
<input name="YES" type="submit" value="YES" id="YES" /><input id="MAYBE" name="MAYBE" type="submit" value="MAYBE" /><input id="NO" name="NO" type="submit" value="NO" /></form>
<?php
$yes = YES;
$maybe = MAYBE;
$no = NO;
if (isset($_POST['YES'])) {
$sql = "INSERT INTO answered(Qanswered, answer)VALUES('$question', '$yes')";
$query = "UPDATE user SET Votes='1' WHERE USER ID='87654' ";
$result=mysql_query($sql);}
if (isset($_POST['MAYBE'])) {
$sql = "INSERT INTO answered(Qanswered, answer)VALUES('$question', '$maybe')";
$result=mysql_query($sql);}
if (isset($_POST['NO'])) {
$sql = "INSERT INTO answered(Qanswered, answer)VALUES('$question', '$no')";
$result=mysql_query($sql);}
?>
</body>
</html>