Calc field problem when submitting form

flashcon

New Member
hi,
I am trying to put together a form for booking a bus seat at specified dates using the calc field for showing the seats remaining.
Tha table is "mytable"
The field "date" as a dropdown of available dates
The field "number" as a field where the number of seats to book are put in.
The calc function should SUM all the "number" WHERE "date" is the one selected.
The form below works fine when filling the form (it calculates fine and shows the result), but when submitting the form the browser gives me 1054 ERROR. Any idea?
---------------------------------------------
$db =& JFactory::getDBO();
$date = JRequest::getVar('ogledi___date', '');
$db->setQuery("SELECT SUM(number) FROM mytable WHERE date = " . $db->Quote($date));
$result = $db->loadResult();
return $result;
 
Back
Top