Forum Moderators: coopster
$dbh=mysql_connect ("localhost", "webist2_guest", "guest") or die
('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ("webist2_testdatatxt");
$model = $_POST['myear'];
$query2 = mysql_query("SELECT FROM table WHERE 'From' <= . '$model' . AND 'To' >= . '$model' . LIMIT 1") or die(mysql_error());
//display data
?>
I think the field names of To and From may be a problem here please help me out though I think I got confused on the quotes and stuff.
$query2 = mysql_query("SELECT FROM table WHERE From <='" . $model . "' AND To >='" . $model . "' LIMIT 1") or die(mysql_error());
or:
$query2 = mysql_query("SELECT FROM table WHERE From <='$model' AND To >='$model' LIMIT 1") or die(mysql_error());