Jump to ContentJump to Navigation/Login
` ` ` ` ` `

[Register]

Occasional ATutor release updates


(11 guests in past 15 min.)

Access Understanding Web Accessibility to learn about accessibility, or Register to take the course for FREE.

Support Forums

ATutor Bug Reports

Useless SQL Query


You must be signed-in to post.

AuthorSubject
  Page: 1
klacroix

Avatar for klacroix
Subject: Useless SQL QueryQuote this post in your reply
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

Avatar for greg
Subject: Re: Useless SQL QueryQuote this post in your reply
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.