|
Posted by Tom on 06/15/07 18:03
On Sat, 09 Jun 2007 13:50:13 GMT, Mark Nenadov wrote...
>
>I'm attempting to pass a SQL query to a MySQL database through PHP's
>mysql_query() function.
>
>When I do it, I get an error saying :
>
>"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 '' at
>line 1"
>
>As far as I can tell, there are no syntax errors in my query. In fact,
>when I run in through the command line mysql client, it works fine.
>
>The query is:
>
>SELECT record.name, musician.name, record.year, rating.id
>FROM musician, reviewer, record
>LEFT JOIN rating ON record.id = rating.record_id
>WHERE musician.id = record.musician_id
>AND (musician.id=19 OR musician.redirect_id=19)
>ORDER BY record.year
>
>I'm using PHP 5.2.1 and MySQL 5.0.26.
>
>Can anyone help me here? Is there any way I can get this query (or
>something that has the same effect) to work with mysql_query()? Does this
>maybe have something to do with the content in the brackets being
>considered a sub query and the PHP mysql_query not supporting sub
>queries? I'd appreciate any assistance I can get.
>
>
Maybe an issue with your MySQL configuration? Might be worth checking the
"mysql" db, especially if your access location to the console is different from
your web server's. Maybe a table in your db has more restricted access?
Tom
--
Newsguy.com
90+ Days Retention
99% Article Completion
Free SSL Connections
Create Your Own NZB Files
[Back to original message]
|