PDA

View Full Version : Resolved Syntax Error, MYSQL error 1064


thesavior
05-16-2009, 02:16 AM
When I run my query through php, I get a 1064 error (normally means im using a reserved word).

However when I run it directly through phpMyAdmin, i don't get any error, and the query works sucessfully.

This is my query:
SELECT lower( 'topic' ) AS
TYPE , `id` , `name` , '' AS displayname, `posterid` , `post_count` , `dateadded` , '' AS message, `lastpostdate` , `lastposterid` ,
MATCH (
name
)
AGAINST (
'eli'
) AS score
FROM new_topics
WHERE MATCH (
name
)
AGAINST (
'eli'
)
UNION SELECT lower( 'post' ) AS
TYPE , p.id, t.name, '', p.posterid, p.topicid, p.postdate, p.message AS message, '', '',
MATCH (
message
)
AGAINST (
'eli'
) AS score
FROM new_posts AS p
INNER JOIN new_topics AS t ON p.topicid = t.id
WHERE MATCH (
message
)
AGAINST (
'eli'
)
UNION SELECT lower( 'user' ) AS
TYPE , `id` , `username` , `displayname` , `avatar` , '', `date_added` , '', '', '',
MATCH (
username
)
AGAINST (
'eli'
) AS score
FROM new_users
WHERE MATCH (
username
)
AGAINST (
'eli'
)
ORDER BY score DESC


And the MYSQL version is: 5.0.51am
PHP Version 5.2.42
and the php client mysql version is 5.0.75

Fumigator
05-16-2009, 09:47 PM
Don't bother posting the actual PHP code that's throwing the error, or the actual error which includes the portion of the query where the error is located. That would be far too helpful.

thesavior
05-16-2009, 09:59 PM
Heh, sorry about that.

The php error is:

Error: Query Failed:S::MySQL error 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 'S' at line 1

and the query I posted was from a $var = QUERY
die($var), so that is the query that is running through php. Php is running it with a mysql_query()

**EDIT**
Ignore me...It was something totally unrelated. Thanks though.