1$mysqli = new mysqli(SERVER, DBUSER, DBPASS, DATABASE);
2$result = $mysqli->query("SELECT id FROM mytable WHERE city = 'c7'");
3if($result->num_rows == 0) {
4 // row not found, do stuff...
5} else {
6 // do other stuff...
7}
8$mysqli->close();