Open
Description
use \InitPHP\Database\Facade\DB;
$data = [
'title' => 'New Title',
'order' => '1',
'content' => 'New Content',
];
$isUpdate = DB::from('post')
->where('id', 13)
->update($data);
/**
* This execute
5421
s the following query.
*
* UPDATE post
* SET title = "New Title", content = "New Content"
* WHERE id = 13
*/
if ($isUpdate) {
// Success
} else {
$errors = DB::getError();
foreach ($errors as $errMsg) {
echo $errMsg;
}
}
Firstly thanks for nice library :D and please keep good updating of it
this code above will give error
Fatal error: Uncaught InitPHP\Database\Exceptions\SQLQueryExecuteException: SQLSTATE[42000]: Syntax error or access violation: 1064 You
have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'order = 1
the problem is column "order" is restracted in mysql and must escaped with ``
how to do that with update function ??
Metadata
Metadata
Assignees
Labels
No labels