Support Forums
ATutor Bug Reports
Useless SQL Query
You must be signed-in to post.
| Author | Subject | |
|---|---|---|
| Page: 1 | ||
| klacroix | Subject: Useless SQL Query | |
| in /include/html/browse.inc.php at Line 87 there is an sql query SELECT COUNT(course_id) AS cnt FROM... The result is assigned to $num_results Then the same query is sent requesting all the fields SELECT * FROM... Problem 1: If the first query is to get the number of rows, then a COUNT(*) should be used which is much faster than specifying a field. Problem 2: Why would a separate query be required to get the number of matching rows when irregardless, a full query is done at which point, mysql_num_rows() could be used to get the same result? This might not result in an error but it seems a waste of a query. - Kent Posted: 2010-02-05 14:16:13 | ||
greg![]() | Subject: Re: Useless SQL Query | |
| Noted. Thanks www.atutor.ca/atutor/mantis/view.php?id=4132 Posted: 2010-02-05 15:51:05 | ||
| Page: 1 | ||
You must be signed-in to post.



