Hi,
Unfortunately I don't know exactly what you try to do.. ;)
But anyway, from the SQL point of view, you should optimize your query that you don't require 2 SQL connections.
Try to execute the following script (replace both selects with the following):
SELECT B.cat_ID as [cat_ID],
A.article_visit AS [Article_Visit]
FROM article_list A
LEFT JOIN category B
ON A.cat_ID = B.cat_ID
WHERE A.article_status = 1
AND B.article_allow = 1
This will return a recordset containing the category id (name:
[cat_ID]
) in the first row and the article-visit count (name:
[Article_Visit]
) (if I understand your code correctly) in the second row.
Please be aware of the fact that the above SQL script is untested and coud require modifications according your SQL infrastructure. ;)
Hope this helps in finding a solution to your problem.
Best regards,
Stops
UPDATE: I forgot to add the where clause in the script.