| View previous topic :: View next topic |
| Author |
Message |
heman Voice
Joined: 30 Dec 2006 Posts: 13
|
Posted: Sun Oct 07, 2007 4:11 pm Post subject: mysql search count |
|
|
If I search someting in the mysql db, after the results it shows someting like:
| Quote: |
1 row in set (0.07 sec)
|
Is there a way to use that info, so it can be announced in the irc channel?
What i am looking for is the count of the result that it found and show that in the channel.
I al ready tried it with:
| Code: |
select count(*) from $table WHERE search like '%$search%';
|
That works, but if the search is in the db a lot, it is slow.
So I thougth way do I need this code if its already shown after the search is done.
Is this possible? Or maybe some1 else know a better and faster way?
thanks |
|
| Back to top |
|
 |
dwickie Halfop
Joined: 21 Aug 2004 Posts: 76 Location: /pub/beer
|
Posted: Sun Oct 07, 2007 7:25 pm Post subject: Re: mysql search count |
|
|
| heman wrote: | If I search someting in the mysql db, after the results it shows someting like:
| Quote: |
1 row in set (0.07 sec)
|
Is there a way to use that info, so it can be announced in the irc channel?
What i am looking for is the count of the result that it found and show that in the channel.
I al ready tried it with:
| Code: |
select count(*) from $table WHERE search like '%$search%';
|
That works, but if the search is in the db a lot, it is slow.
So I thougth way do I need this code if its already shown after the search is done.
Is this possible? Or maybe some1 else know a better and faster way?
thanks |
for example: use SELECT (with rows, not count(*)) and then SELECT FOUND_ROWS() below to see number of matches. there is more ways how to do that, if i got correctly what you want to do |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|