When I issue the following query in the mysql console for my database, I get the following:
mysql> SELECT ipaddr FROM ipposts WHERE ipaddr=2149856614;
+------------+
| ipaddr |
+------------+
| 2149856614 |
| 2149856614 |
| 2149856614 |
+------------+
3 rows in set (0.00 sec)
However, the following codesnippet from my php:
$query = "SELECT ipaddr FROM ipposts WHERE ipaddr=2149856614";
$result = mysql_query($query);
$rows = mysql_num_rows($result);
if($rows == 0)
return addIP($ip);
Calls addIP() everytime. Why is this?
EDIT I used mysql_error() to dump out one that I've never seen before "TABLE 'ipposts' was not locked with LOCK TABLES", I added a LOCK READ,WRITE and an UNLOCK in my function and now it works. I'm not sure why mysql wanted my to lock this in this function?