09-08-2020, 03:40 PM
Hi guys,
Quick question, minor problem (I think)!
I am trying to update a 'DateTime' column in MariaDB/MySQL using the builder class but I keep getting this error:
Call to undefined function App\Models\now()
I tried setting the update column using the following methods:
Method 1:
Method 2:
Method 3:
Is there something I am missing here? Or is it impossible to work with Maria/MySQL's internal functions using the Builder Class?
No biggie if its impossible, as I can always resort to PHP Date/Time functions and have PHP do the work instead of MariaDB doing it.
So this is more of a curiosity question as well as a serious one.
Quick question, minor problem (I think)!
I am trying to update a 'DateTime' column in MariaDB/MySQL using the builder class but I keep getting this error:
Call to undefined function App\Models\now()
I tried setting the update column using the following methods:
Method 1:
PHP Code:
$UpdateData = [
'title' => $title,
'slug' => $slug,
'updated' => NOW(),
'post' => $post
];
$builder->where('slug',$slug);
$builder->update($UpdateData);
Method 2:
PHP Code:
$builder->set('updated=NOW()');
$builder->where('slug',$slug);
$builder->update($UpdateData);
Method 3:
PHP Code:
$builder->set('updated',NOW());
$builder->where('slug',$slug);
$builder->update($UpdateData);
Is there something I am missing here? Or is it impossible to work with Maria/MySQL's internal functions using the Builder Class?
No biggie if its impossible, as I can always resort to PHP Date/Time functions and have PHP do the work instead of MariaDB doing it.
So this is more of a curiosity question as well as a serious one.