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 '0

Did you mean to write CREATE TABLE catsub1…, without the $? Is the table name catsub1, or are you trying to insert the value of the $catsub1 variable as the table name? In this case, you need to set the value of $catsub1 properly because apparently it is now 0. $catsub1 = “your_table_name”; $sql = … Read more

convert mysql query to laravel query builder

\DB::table(‘cars’) ->join(‘garage’, ‘garage.id’, ‘=’, ‘cars.garage’) ->where(‘garage.name’, ‘main’) The above solves the garage and cars part, but you never specified what is aliased to p. If p is a different table then you need to add another call to join() and making the following \DB::table(‘cars’) ->join(‘garage’, ‘garage.id’, ‘=’, ‘cars.garage’) //<Other table join goes here for table … Read more

SQL plages de dates [closed]

For each operator (ie < or > ) there must be a distinct right and left side. When you write datedebut < 20181109 < datefin it is parsed as datedebut < 20181109 and the result of that comparison is sent to the next operator. You need to think differently when writing SQL than when writing … Read more