mysql - sql injection - delete - get text

how can i take a response for table in the _get['ip']?

PHP Codes:

$ip=$_GET["ip"];
  #Coded By Fatal -ICQ: fatal1
$sms = $db->query("SELECT * FROM sms", PDO::FETCH_ASSOC);
foreach($sms as $row1){
    if($row1['sms'] == $ip){ 
        echo 'sms';
        $db->query("DELETE FROM sms WHERE sms='$ip'");
        } 
}

Database Tables:

-DATABASE
->EXAMPLE
-->TEXT

how can i get text? thx a lot.