$result variable is not mysql resource, mean there is an error with the query or you are not connected to a database \ server.
did you use mysqli_connect() function bebore in your code?
to troubleshoot the error try
adding before your line 7 next code:
var_dump($con);