Skip to content
Advertisement

IlluminateDatabaseQueryException: SQLSTATE[42000]: Syntax error or access violation: 1064

i m trying to add this query into my code in laravel. it runs smoothly in phpmyadmin or with mysql command line but enable to get anything but this syntax error.

my query :

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 ‘select o.* from o

NOTE:

  • Tried ‘strict’ -> false
  • Using DB::select();
  • DB::unprepared() the only that doesnt return any error but it doesnt return the result neither only a (TRUE)

EDIT

when i remove the last statment i get this :

SQLSTATE[HY000]: General error: 2014 Cannot execute queries while other unbuffered queries are active. Consider using PDOStatement::fetchAll(). Alternatively, if your code is only ever going to run against mysql, you may enable query buffering by setting the PDO::MYSQL_ATTR_USE_BUFFERED_QUERY attribute.

Advertisement

Answer

could be you env don’t allow multiple query in a single statement so due the fact your temp table seems not update try using a dynamic query instead of a create temp table

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement