Error in phpmyadmin, although it works fine in PHP script

Okay, so this is weird, and I think there should be a problem in my SQL query, but I see nothing wrong with that. What happens is that I have a script that I run in a PHP script that retrieves all the categories that the user signed, as well as how many other people signed up for the same category. When I run the request on the php page, it is very slow, but returns the results. I wanted to see what happens, so I went to phpmyadmin to run the same script and it returns the number of results very quickly, but then gives me the following error, where the results will usually 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 request:

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'm at a loss. The reason for my question is really double:

  • - , ?
  • , mysql , script , php - ? ( , )

!

+3
3

PHPMyAdmin (, LIMIT 0,30, 30 ).

- , ?

, , . . ?

+1

? , :

`table name`
0

What you need to do is remove phpmyadmin and promise not to download it again.

Then run mysql command line prompt and try the same query. This will tell you if the request is really bad, or if phpmyadmin just destroyed it for the perverse pleasure of its erroneous authors.

0
source

Source: https://habr.com/ru/post/1757408/


All Articles