billyjeffjoe
Technical User
I am having a wierd problem. I have a MySQL database with some data in it. When I query it from the command line, it returns 179 rows with the expected content. If I do this:
$rows = mysql_num_rows($result);
printf("ROWS = $rows\n");
from PHP I get 179 back. However the actual number of rows output to the screen by PHP vary between 35 and 80 each time I reload the page. It is as if the connection is lost in the middle of the results being returned. There doesn't seem to be any rhyme or reason for it. There is no change to the database between reloads. The query is this:
$result = mysql_query("SELECT SourceIp, IF(COUNT(distinct Device)>1,'YES','') AS 'MULTIDEV', SUM(IF(MessageType='IDS',1,0)) AS 'IDS', SUM(IF(MessageType='NtwkACL',1,0)) AS 'ACL' FROM DredgeEvent GROUP BY SourceIp ORDER BY inet_aton(SourceIp);",$db) or die ("MySQL error: " . mysql_error());
I am, of course, not an expert at PHP or MySQL, but I have never had this problem before and I can't find a similar problem on Google. PHP and MySQL are on the same device. I don't get any errors when I reload the page. Any advice?
-Matt
$rows = mysql_num_rows($result);
printf("ROWS = $rows\n");
from PHP I get 179 back. However the actual number of rows output to the screen by PHP vary between 35 and 80 each time I reload the page. It is as if the connection is lost in the middle of the results being returned. There doesn't seem to be any rhyme or reason for it. There is no change to the database between reloads. The query is this:
$result = mysql_query("SELECT SourceIp, IF(COUNT(distinct Device)>1,'YES','') AS 'MULTIDEV', SUM(IF(MessageType='IDS',1,0)) AS 'IDS', SUM(IF(MessageType='NtwkACL',1,0)) AS 'ACL' FROM DredgeEvent GROUP BY SourceIp ORDER BY inet_aton(SourceIp);",$db) or die ("MySQL error: " . mysql_error());
I am, of course, not an expert at PHP or MySQL, but I have never had this problem before and I can't find a similar problem on Google. PHP and MySQL are on the same device. I don't get any errors when I reload the page. Any advice?
-Matt