Jump to content

[SOLVED] $SQL Help


Swole

Recommended Posts

Ok my problem is I'm trying to get this page to pull a random quote from my database and then give the user a option if they like the quote or not. So after the user decides if they like it or not they click a button with whatever choice they made. I want to get it so once they click the button it will send the answer and the quote to another table. My problem is i can get it to work untill I add $sql into the code and then the page stops displaying anything.  (Sorry for any grammer or spelling problem. English was never my strongest subject,lol.)

 

<!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 action="index.php" method="post">
<input id="YES" name="YES" type="submit" value="YES" /><input id="MAYBE" name="MAYBE" type="submit" value="MAYBE" /><input id="NO" name="NO" type="submit" value="NO" /></form>

<?php
if(isset($_POST['YES'])){
 $sql =
  
          }
?>


</body>

</html>

 

Link to comment
https://forums.phpfreaks.com/topic/176005-solved-sql-help/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.