Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

test if a db query gets "hit's" 3

Status
Not open for further replies.

leegold2

Technical User
Joined
Oct 10, 2004
Messages
116
Newbie ques.

I want to be able to test if a db query gets "hit's" or not, so eg,
$query = SELECT * from table...
$result = mysql_query($query)...

Now I assume I would test at some point with:
mysql_num_rows...to see if anything was returned,

Could anyone supply a snippet to show me how?
Thanks

 
Thanks I see it now...
 
If you are not interested in the actual results, then it would be much less resource intensive on the server to do "select count(*) from table where ..." and check the resulting count. Otherwise the server will allocate memory to start returning all those rows that matched.
 
I dont know if this is a one-time action, but..

If you select more fields than you have to, performance will suffer.



Olav Alexander Mjelde
Admin & Webmaster
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top