kaito
Member
I have an element field to display some chained info in a QR, that will be stored in database afab_entrenamiento. In PHP validation I need to retrieve last "id" from database, so I make the query but it replies with a SQL Maria DB syntax error:
"1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'FROM afab_entrenamiento' at line 2"
My query code into php validation frame is:
I have maden lots of combinations in order yo overcome this error but I haven´t found the correct one. Anyone can help me? Thanks in advance
"1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'FROM afab_entrenamiento' at line 2"
My query code into php validation frame is:
PHP:
//para conocer el identrenamiento con el que voy a grabar esta información, tengo que consultar cuál es el último id de la tabla afab_entrenamientos y sumarle una unidad
$mydb = JFactory::getDbo();
$myQuery = $mydb->getQuery(true);
$myQuery
->select (MAX('id'))
->from('afab_entrenamiento');
$mydb->setQuery($myQuery);
$lastid = $mydb->loadResult();
$identrenamiento = $lastid + 1;
I have maden lots of combinations in order yo overcome this error but I haven´t found the correct one. Anyone can help me? Thanks in advance