lundi 24 juin 2019

"SQLSTATE[42000]:Syntax error or access violation:1064You have anerror in your SQLsyntax;

I have an problem in the LARAVEL I want to make a selection of phones and after filling a form. So I have the genre (phone, tablet), the brand (samsung, oppo ...) and the type (S10 +, S3S ...) and I want to pass the mark and gender parameter to fill the form. but when I go to show the guy it gives me a problem.

Controller :

public function affiche(){
    $listgenre = DB::select('select distinct genre_mobile from mobiles');
    return view('reparation.reparation', ['mobiles' => $listgenre]);
}

//affiche la page des marques après le genre 
public function affichemarque($genre){
    $listmarque = DB::select('
                    select distinct marque_mobile , genre_mobile from mobiles where genre_mobile = ?', [$genre]); 
    return view('reparation.marque', ['mobiles' => $listmarque]);
}

//Affiche Type of mobile après la marque
public function affichetype($genre, $marque){
$listtype = DB::select('select * from mobiles where genre_mobile = '.$genre.'and marque_mobile='.$marque);
    return view('reparation.type', ['mobiles' => $listtype]);
}

routes :

Route::get('reparation/rep', 'AppController@affiche'); //page choix telephone or tablette

Route::get('reparation/{genre}/marque', 'AppController@affichemarque'); //choix des marques (samsung, oppo, apple ...)

Route::get('reparation/{genre}/{marque}/type', 'AppController@affichetype'); //type( S3, S10+, s70 ...)

The probleeem : "SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'marque_mobile=SAMSUNG' at line 1 (SQL: select * from mobiles where genre_mobile = telephoneand marque_mobile=SAMSUNG) ◀"



from Newest questions tagged laravel-5 - Stack Overflow http://bit.ly/2J83MnL
via IFTTT

Aucun commentaire:

Enregistrer un commentaire