mysqli_num_rows

I am trying to learn some PHP and in order to do that I try to create all kinds of stupid scripts. To play around with INSERT a created a form with a button. First i just want to echo the database content:

include 'included/connect.php';
include 'included/form.html.php';


if (isset($_POST['knapp']))
{	

$result = mysqli_query($link, "SELECT * FROM ipnumber");


 $row_cnt = mysqli_num_rows( $result);
 printf("Result set has %d rows.\
", $row_cnt);
   mysqli_free_result($result);
}

I get this error:

Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean given in C:\xampp\htdocs\index.php on line 15
Result set has 0 rows.
Warning: mysqli_free_result() expects parameter 1 to be mysqli_result, boolean given in C:\xampp\htdocs\index.php on line 17

I have consulted the PHP manual, but it did not make any sense too me. What am I supposed to do with mysqli_num_rows? How do I write it with the parameter?

The error is telling you that $result is not a mysql_result, but a bool (in this case false). This means that there’s an error in your query.

To see what’s going wrong, use mysqli_error:

$result = mysqli_query($link, "SELECT * FROM ipnumber") or die (mysqli_error($link));