It's 12:30am and I've been coding for 9 hrs straight. I really should understand this project done, but MySQL is playing with my deadline. Would you examine this snippet for me personally and try to discover what's wrong?

PHP/MySQL Query

$q = $this->db->query("SELECT * FROM bans WHERE ip='".$ip."'");

Keeps coming back the next error...

MYSQL Error [March sixth, 2010 11:31pm CDT]
You possess an error inside your SQL syntax look into the manual that matches your MySQL server version for the best syntax to make use of near '* FROM restrictions WHERE ip='206.53.90.231'' at line 1 (1064)

I don't see anything wrong using the query. I have even attempted different techniques of such as the variable $ip however with no avail.

EDIT:
Simply to include here, the ip column during my database is really a varchar(255).

EDIT 2:
This is actually the whole affected code. Bear in mind this is inside a class. If I am missing something, tell me.

Line from another Function

if($this->isBanned($_SERVER['REMOTE_ADDR'])===true) { return json_encode(array('error'=>'You are banned from this ShoutBox.')); }

Affected Function

function isBanned($ip) {
    $q = $this->db->query("SELECT * FROM bans WHERE ip='".$ip."'"); $num = $this->db->affected_rows;
    if($num>0) { $row = $this->db->fetch_array($q); if(($row['expires'] < time()) && ($row['expires'] !== 0)) { $this->unbanUser($ip,'internal'); return false; } return true; } return false;
}

unbanUser function

function unbanUser($ip,$t='box') {
    $q = $this->db->query("SELECT * FROM bans WHERE ip='".$ip."'"); $num = $this->db->affected_rows; if($num>0) { $q = $this->db->query("DELETE * FROM bans WHERE ip='".$ip."'"); 
    return (($t=='box') ? json_encode(array('status'=>'removed')) : true); } else { return (($t=='box') ? json_encode(array('error'=>'Unable to locate the user.')) : true); }
}

It might be It's your DELETE statement that is leading to the mistake.

Take away the * following the DELETE and it ought to be fine.

Do this:

$q = $this->db->query('SELECT * FROM bans WHERE ip="' . $ip . '"');

Check if you work with the ' character or even the ยด character (the final the first is a highlight)