Re: Paginatating PHP

From: Date: Thu, 21 Dec 2006 10:35:07 +0000
Subject: Re: Paginatating PHP
References: 1 2  Groups: php.db 
Request: Send a blank email to php-db+get-42831@lists.php.net to get a copy of this message
It's better to use SQL_CALC_FOUND_ROWS and information function FOUND_ROWS(). For more information see http://dev.mysql.com/doc/refman/4.1/en/information-functions.html Find: FOUND_ROWS() Iky OKi98 wrote:
Chris Carter wrote: There is enough data to display this result and to paginate but its simply showing the else condition which does not have NEXT or PREVIOUS hyperlinked. ... $query_count = "SELECT count(*) FROM students"; $result_count = mysql_query($query_count); $totalrows = mysql_num_rows($result_count); well, the result is always 1 (even if no students are present), you need to use some mysql_fetch_* function to get the count of students ie. $tmp=mysql_fetch_row($result_count); $totalrows=$tmp[0]; OKi98


« previous php.db (#42831) next »