public function updateMovie(Request $request, $id)
{
$request->title;
$movie = DB::connection('mysql2')->select('UPDATE cb_video SET title='.$request->title.' WHERE videoid=' . $id);
return response()->json(['status' => 'success', 'data' => $movie]);
}
I am trying to update title in db but its throwing me error of
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 ‘WHERE
videoid=1449’ at line 1 (SQL: UPDATE cb_video SET title= WHERE
videoid=1449)
what can I do?
3
Answers
I hope you find this helpful
Thanks
there are many better ways in laravel than what you are doing you could use query builder or eloquent to do your task and in a secure way
for example
and as I can see in your error it mean that you are not sending the title in the request