I am receiving 2 params from a querystring in my page url header. I want to use those parrams as date criteria for a query, but anytime I try to add to my where clause the page returns a 500 error.
This is my syntax, what should I change so that I can use these two variables in my where clause?
<?php
header('Access-Control-Allow-Origin: *');
$begin = $_GET['begin'];
$end = $_GET['end'];
$option = array(); //prevent problems
$option['driver'] = 'mssql';
$option['host'] = 'XXX.XXX.XX.XX';
$option['user'] = 'user';
$option['password'] = 'pass';
$option['database'] = 'database';
$option['prefix'] = '';
$db = JDatabase::getInstance( $option );
$result = $db->getQuery(true);
$result->select($db->quoteName(array('Teacher', 'student', 'countenrolled', 'countattending')));
$result->from($db->quoteName('[SchoolStuff'));
$result->where($db->quoteName('registerdate') . ' >= '. $begin. AND ' <= ' .$end.);
$db->setQuery($result);
$results = $db->loadObjectList();
?>
<table border="1">
<thead>
<tr>
<th>Teacher</th>
<th>Student</th>
<th>Count Enrolled</th>
<th>Count Attending</th>
</tr>
</thead>
<tbody>
<?php
foreach( $options as $option ) {
print "<tr>";
print "<td>".$option->Teacher."</td>";
print "<td>".$option->Student."</td>";
print "<td>".$option->CountEnrolled."</td>";
print "<td>".$option->CountAttending."</td>";
print "</tr>";
}
?>
</tbody>
</table