Page Chapter 5. Working with Databases, Page 54
Sat, 12/29/2007 - 3:38am — DrupalUSC
Location on the page:
Getting Results for Paged Display
Error:
The line reading...$result = pager_query(db_rewrite_sql($sql), 0, 10); ... is incorrect. According to the drupal API documentation, the second paramater to the pager query is the number of query results to display per page. This number is used in a division arithmatic operation somewhere in Drupal. When it is set to 0, a divide by zero error is return.
Correction:
The default number of page results is 10, so simply stating...$result = pager_query(db_rewrite_sql($sql));... works just fine. If a user wanted 25 results per page he can have $result = pager_query(db_rewrite_sql($sql));
Description of the Error:
Divide by Zero error
