You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
use \InitPHP\Database\Facade\DB;
$data = [
'title' => 'New Title',
'order' => '1',
'content' => 'New Content',
];
$isUpdate = DB::from('post')
->where('id', 13)
->update($data);
/**
* This executes 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 ??
The text was updated successfully, but these errors were encountered:
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 ??
The text was updated successfully, but these errors were encountered: