I have just about give up on this. I am trying to create a drop down whose selection based on the current day. here is the code i keep getting Parse error: syntax error, unexpected T_IF in C:\xampp\htdocs\date2\index.php on line 21 (in the example it is line #20)
Code: Select all
<?
require("connection.php");
$q = "SELECT `tb_day_of_week`.`id`, `tb_day_of_week`.`day_of_week`\n"
. "FROM `tb_day_of_week`\n"
. "ORDER BY `tb_day_of_week`.`id` ASC\n"
. " LIMIT 0, 30 ";
$result = $mysqli->query($q) or die($mysqli_error($mysqli));
print '<select name="weekend">';
if($result) {
while($row = $result->fetch_object()) {
$id = $row->id;
$day = $row->day_of_week;
print '
<option value="'.$id.'"'.
if ($id == $daynum) {
print 'selected';
}.'>'.$day.' </option>';
}
}
print '</select> ';
?>