Re: [PHP-DB] Paginatating PHP
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 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Paginatating PHP
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 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Paginatating PHP
On 12/21/06, Ondrej Kohout <[EMAIL PROTECTED]> wrote: It's better to use SQL_CALC_FOUND_ROWS and information function FOUND_ROWS(). Has nothing to do with the problem. "its simply showing the else condition which does not have NEXT or PREVIOUS hyperlinked." Try "OKi98's" suggestion, it will most likely fix the problem for you. -- Postgresql & php tutorials http://www.designmagick.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php