<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"><channel><title>Patchlog - Latest Comments in PatchLog | MySQL: counting results</title><link>http://patchlog.disqus.com/</link><description></description><language>en</language><lastBuildDate>Thu, 03 Jul 2008 08:47:15 -0000</lastBuildDate><item><title>Re: PatchLog | MySQL: counting results</title><link>http://patchlog.com/databases/mysql-counting-results/#comment-2804058</link><description>too late :)</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">symx</dc:creator><pubDate>Thu, 03 Jul 2008 08:47:15 -0000</pubDate></item><item><title>Re: PatchLog | MySQL: counting results</title><link>http://patchlog.com/databases/mysql-counting-results/#comment-2804057</link><description>Oh, yeah, kinda useless comment, I misunderstood what you had to say, please delete my stupidity.&lt;br&gt;&lt;br&gt;And I know it's not correct because I said it's an idea, I didn't wrote something just from dreams, that's how I've queried for pagination, of course counting separately the total number of results.</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">vassy</dc:creator><pubDate>Thu, 03 Jul 2008 02:46:02 -0000</pubDate></item><item><title>Re: PatchLog | MySQL: counting results</title><link>http://patchlog.com/databases/mysql-counting-results/#comment-2804056</link><description>and your code is not really correct, no to mention it doesn't do any escaping on possible user input ...</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">symx</dc:creator><pubDate>Thu, 03 Jul 2008 02:03:45 -0000</pubDate></item><item><title>Re: PatchLog | MySQL: counting results</title><link>http://patchlog.com/databases/mysql-counting-results/#comment-2804060</link><description>I don't think anyone is having trouble writing those two lines of code or more. &lt;br&gt;The idea of this post was discussing how to count the total number of results as fast as possible without putting too much load on the server  on complex queries possibly joining several large tables.</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">symx</dc:creator><pubDate>Thu, 03 Jul 2008 02:00:53 -0000</pubDate></item><item><title>Re: PatchLog | MySQL: counting results</title><link>http://patchlog.com/databases/mysql-counting-results/#comment-2804059</link><description>var $on_page = 10;&lt;br&gt;&lt;br&gt;function listStuff($page)&lt;br&gt;{	&lt;br&gt;	$start = ($page - 1) * $on_page;&lt;br&gt;	mysql_query("SELECT * FROM stuff LIMIT $start,$on_page");&lt;br&gt;}&lt;br&gt;&lt;br&gt;this is the idea in the list function, you can call it with different page numbers to get where you want, even to the first or last page.</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">vassy</dc:creator><pubDate>Wed, 02 Jul 2008 17:38:02 -0000</pubDate></item></channel></rss>