Welcome Guest, Not a member yet? Register   Sign In
Using Maria/MySQL Internal Time Functions in the Builder Class?
#1

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:

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. 
Reply


Messages In This Thread
Using Maria/MySQL Internal Time Functions in the Builder Class? - by stlake2011 - 09-08-2020, 03:40 PM



Theme © iAndrew 2016 - Forum software by © MyBB