mercredi 12 janvier 2022

Unable to insert special characters into database in mysql laravel (especially & character)

I want to insert " ~!@#$%^&*()?<>:\| " this string into my table but when I hit save it inserts only this much in table ~!@#$%^, rest of the characters doesn't store in the table.

Here is my laravel controller code

public function store(Request $request)
    {
   
        $x = $request->get('task_name');

        DB::insert('insert into tasks (task_name) values (?)', [$x]);

        $tasks = DB::table('tasks')
                     ->select(DB::raw('task_id,task_name,created,status,prority'))
                     ->where('isActive', '=', '1')
                     ->get();
       
        return $tasks;
}


from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/3Ki8JsS
via IFTTT

Aucun commentaire:

Enregistrer un commentaire