There is a database, id | ip | text | I make a request:

$sql = mysql_query("SELECT `Ippred`, `Text` FROM `pred` WHERE `Ippred` like '%".$ip."%'"); $result = mysql_fetch_array($sql); if ($result > 0){ echo '<div style="color:black;width:50%;">'; echo 'Ваш IP адрес был найден в базе' ; echo '</div>'; 

I tried to implement through like, anyway it only displays there will be a complete match, and I need to, if the user comes under ip, for example, 178.71.137.107, then if the database has ip 178.71. , he deduced that ip was found

  • one
    well, then your request should look like ... like '178.71.%', well, maybe another% at the beginning if you have several ipes in the field (which is not true, if so). So cut off the start from ip in advance and check for it - Mike
  • "all the same, only there will be a complete coincidence" risovach.ru/upload/2015/06/mem / ... - Invision

0