To familiarize myself with inserting and updating various Fabrik plug-in types via a php-generated sql statement, I created a table named 'test_tbl' with fields 'mystring', 'myinteger', 'mydecimal', and 'mydate'.
I have created php code to update each field type, but the date field will not update. I have tried it as a string and as a unix timestamp, but I cannot successfully create the query to update the field. I assume the problem is creating a string for the sql query with the proper format for the mydate field. My latest code iteration is below:
This successfully updates the string, integer, and decimal fields but the date field is blank. Can someone help me with the proper syntax?
I have created php code to update each field type, but the date field will not update. I have tried it as a string and as a unix timestamp, but I cannot successfully create the query to update the field. I assume the problem is creating a string for the sql query with the proper format for the mydate field. My latest code iteration is below:
PHP:
<?php
$db = &JFactory::getDbo();
$query = $db->getQuery(true);
$date= strtotime("1994-12-24");
$update = "UPDATE test_tbl SET mystring='Trying a date using strtotime.', myinteger='654321', mydecimal='14.769', mydate='".$date."' WHERE id=1";
$db->setQuery($update);
$db->query();
?>