Ok so this one is strange and I'm thinking there must be a problem in my sql query but I don't see anything wrong with it. What is happening is that I have a script that I am running in a php script that retrieves all categories that a user has signed up for as well as how many other people have signed up for the same category. When I run the query in the php page it is very slow but does return results. I wanted to see what was happening so I went to phpmyadmin to run the same script and it returns the count of the results very fast but then gives me the following error where the results would normally be displayed:
#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 '' at line 1
Here is the query:
SELECT t1.category_id, t3.description AS 'Category',
t1.list_type_id, t2.name, t1.status_id, t2.user_id,
t2.email, UNIX_TIMESTAMP( t1.record_date ) AS 'RecordDate',
(
SELECT COUNT( category_id )
FROM t1_sub
WHERE t1_sub = t1.job_ctg_id AND
t1_sub.list_type_id = t1.list_type_id AND
t1_sub.status_id =44
) AS 'MatchingListings'
FROM t1
INNER JOIN t2 ON t2.id_rfp_vendor_data = t1.user_id
INNER JOIN t3 ON t3.type_lookup_id = t1.job_ctg_id
WHERE t1.status_id =43
I am at a loss. The reason for my question is really two fold:
- Is there actually something wrong with my query that I am missing?
- If not, is the error mysql showing the reason why my script is running slow and that php has some way around this? (Though this seems like an unlikely possibility I just have to ask to be sure)
Thanks!