-6

I been trying to learn how to code and been looking at examples. In this line i am getting the topic error can someone explain what this line does and why it creates that error

$pages = ceil(mysql_result($pages_query, 0) / $per_page); //dividing total rows with total data to
gen_Eric
  • 214,658
  • 40
  • 293
  • 332
Vizionz
  • 1
  • 4
  • 1
    The problem is you are assuming that `mysql_query` succeeded. When it doesn't, it returns `FALSE`, which `mysql_result` doesn't like. Add `if($pages_query === FALSE){ die(mysql_error()); }` to your code. P.S. This is one of the most commonly asked MySQL questions, try to search before asking. – gen_Eric Oct 01 '13 at 19:34

1 Answers1

0

This is because in the line:

$pages = ceil(mysql_result($pages_query, 0) / $per_page); //dividing total rows with total data to

mysql_result($pages_query, 0);

return false.

Pupil
  • 23,528
  • 5
  • 42
  • 64