PHP Form Error

What is going wrong?

latin.allderek.com/input.html (this is a fourm that passes data to PHP)

<?php // Declare Buttons // Connect to Allderek.com Latin Vocab Database. $link = mysql_connect('localhost', 'allderek_latindb', 'latin'); if (!$link) { die('Could not connect: ' . mysql_error()); } $db_selected = mysql_select_db('allderek_latin', $link); if (!$db_selected) { die ('Cant use Latin DB' . mysql_error()); } // Cookie Check if($_COOKIE['wordid'] == null){ $chapbegin = $_POST['quizbegin']; //What chapter to begin Quizzing $chapend = $_POST['quizend']; // Last Chapter to Quiz } else { $done = $_COOKIE['done']; $wordid = $_COOKIE['wordid']; } // Begin Chapter Detection $beginrandq = mysql_query('SELECT MIN(ID) FROM vocab WHERE chapter BETWEEN '. $chapbegin.' and '. $chapend); // Assigns the first and last questions to quiz on $endrandq = mysql_query('SELECT MAX(ID) FROM vocab WHERE chapter BETWEEN '. $chapbegin.' and '. $chapend); $beginrand = mysql_fetch_array($beginrandq); //Convert Query to Array $endrand = mysql_fetch_array($endrandq); // Begin Quiz $wordid = rand($beginrand[0],$endrand[0]); //Sets which word will get drawn if($_COOKIE['wordid' == null]){ $endrandtemp = $endrand; $done[$endrandtemp]; } $done[$wordid]= 1; //Sets the latinword as done $query = mysql_query('SELECT LATIN FROM vocab WHERE id = '.$wordid); //Queries for word $latinword = mysql_fetch_array($query); //converts latin word to array // Save Vars to Cookie setcookie("wordid", $wordid, time()+3600); setcookie("done", $done, time()+3600); setcookie("chapbegin", $chapbegin, time()+3600); setcookie("chapend", $chapend, time()+3600); // Generate Page echo $latinword[0]; ?>

First two warning messages refers to a problem in your SQL query (either table is missing or spelled wrong, or table field(s) is missing or spelled wrong) in these lines:
[php]
// Begin Chapter Detection
$beginrandq = mysql_query('SELECT MIN(ID) FROM vocab WHERE chapter BETWEEN ‘. $chapbegin.’ and '. $chapend); // Assigns the first and last questions to quiz on
$endrandq = mysql_query('SELECT MAX(ID) FROM vocab WHERE chapter BETWEEN ‘. $chapbegin.’ and '. $chapend);
[/php]
Make sure table & field names are spelled correctly in your queries (they are case sensitive, unless you are on Windows).
And the rest 4 warning messages should disappear once you fix first two.

Warning: Cannot modify header information - headers already sent by…

This warning appears if some output is sent by script, before the calls to any of these functions: header(), setcookie().

Sponsor our Newsletter | Privacy Policy | Terms of Service