php / mysql - fsockopen

Primal

LOMCN VIP
VIP
Jun 28, 2004
1,756
102
259
is this possible?
What im wanting is a php script that loads a mysql database and reads several rows and their ip's, and then uses fsockopen on each one and returns the info (online or not or whatever)

e.g.

php script reads mysql

ID - ip_address
1 - ip1
2 - ip2
3 - ip3
4 - ip4
5 - ip5

is it possible to do these in an array so then you can use sumthing like this:

PHP:
fsockopen($iparray[$i],$portnumber,$errno, $errstr, 5 );

thanks to whoever helps
 

Kaori

LOMCN MiR3 Queen!
VIP
Jun 3, 2004
3,584
38
285
Canada
assuming you have sql like...
select ip, port from servers;
PHP:
	while ($row = mysql_fetch_row($result)) {
		$ip = $row[0];
		$port = $row[1];
		fsockopen($ip, $port, $errno, $errstr, 5);
	}
 

Primal

LOMCN VIP
VIP
Jun 28, 2004
1,756
102
259
thanks for reply but that only does the fsockopen on the 1st ip returned and then when it updates the db it only updates the last row