problem with Form Plugin

hello,
I'm using this simple code in form-plugin (end of form submission - onAfterProccess) and it doesn't work:

$sql = "UPDATE cars SET code='0000' WHERE id=1";
mysqli_query($conn, $sql);

'code' value never changes. Can you tell me why?
Thanks
 
$conn is not set by default?? I'm establishing the connection to the database with command:
$db = JFactory::getDBO();
and works if I extract data, but not for updating
 
Code:
$mydb = JFactory::getDbo();
$query = $mydb->getQuery(true);
$query->update($mydb->quoteName('cars'))->set($mydb->quoteName('code').' = '0000'')->where($mydb->quoteName('id').' = 1');
$mydb->setQuery($query);
$mydb->execute();
Where do I send my invoice? :)
 
Last edited:
Code:
$mydb = JFactory::getDbo();
$query = $mydb->getQuery(true);
$query->update($mydb->quoteName('cars'))->set($mydb->quoteName('code').' = '0000'')->where($mydb->quoteName('id').' = 1');
$mydb->setQuery($query);
$mydb->execute();
Where do I send my invoice? :)
I can offer you a coffee :D ...thank you very much! I have found the problem, I never used the "quote" keyword for print variables in query. Thanks ;)
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top