-1

i've created a mysql view which is expecting 2 parameters and i'm able to query it without problems in phpyadmin with the following sql-string:

SET @date1 = '2014-02-06'; 
SET @date2 = '2014-02-07'; 
SELECT * FROM _myquery 

it will not work under php - i'm getting the following error:

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 'SET @date2 = '2014-02-07'; SELECT * FROM _myquery' at line 2

when it's working in phpmyadmin, shouldn't it also work under php? any idea what's wrong?

Fuxi
  • 7,611
  • 25
  • 93
  • 139

1 Answers1

1

Do you really need the MySQL variables? because your SELECT query is not using them. You can try just with

SELECT * FROM _myquery

But if you really need to use MySQL variables, take a look at this:

Mysql Variables not working through php mysql query

MySql variables and php

Community
  • 1
  • 1
Lordn__n
  • 328
  • 2
  • 11