Buenas, estoy haciendo unas consultas con get_records_select, hasta ahora bien, pero el problema es que tengo que hacer unas consultas ahora que a veces no me devuelven datos (son comprobaciones) y me tira un error. Trabajo con Moodle 1.9.
$row = get_records_select('khronos_activity', 'student = '.$USER->id.' AND starttime <= '.$data[$this->_nameform.'initeditedperiod'].' AND endtime > '.$data[$this->_nameform.'initeditedperiod'], '', '*');
if ($row != false){
Al ejecutarla en el módulo, me tira este mensaje, que creo que es porque no devuelve nada, igual estoy equivocado:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'student = 5 AND starttime 1331877600' at line 1
SELECT * FROM mdl_khronos_activity WHERE id != 134 student = 5 AND starttime <= 1331877600 AND endtime > 1331877600
- line 686 of lib/dmllib.php: call to debugging()
- line 609 of lib/dmllib.php: call to get_recordset_sql()
- line 930 of lib/dmllib.php: call to get_recordset_select()
- line 579 of mod/khronos/khronos_supervisor_form.php: call to get_records_select()
- line 362 of lib/formslib.php: call to khronos_supervisor_form->validation()
- line 320 of lib/formslib.php: call to moodleform->validate_defined_fields()
- line 407 of lib/formslib.php: call to moodleform->is_validated()
- line 157 of mod/khronos/view.php: call to moodleform->get_data()
A ver si me decis como puedo solucionarlo. Un saludo.