The below is used to disallow certain IP's from posting scores a website game.
If their IP is, eg:, then I have found I am having to enter the full IP into the Db in order to deny.
How can the below be written so that I can enter just, eg: 1.2. so all corresponding IP's, eg:, are disallowed?

Thanks for any help.

$query = mysql_query('SELECT ip FROM table_name') or error_msg('Could not access database.');
while ($row = mysql_fetch_row($query)) {
if ($player_ip == $row[0]) error_msg('Scoring disallowed');