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;
}


via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire