从MySQL中提取数据并重用PHP中的pingscript

I'm usually not the "scripting" guy

but I have been given a task, to create a script, that ping all our network equipments. (~300 devices) so I have come so fat, we can manage and edit the Excel and export as CVS into MySQL database, so far...

I have been searching around for a valid example to directly use the "IP" table from the database into my pingscript or to pull the SQL data and insert into a Array..

However, I have contact with the database, but I am unable to print the array data into my ping script however.

When I do a ECHO ['$databasename']; I get the result out, but I don't figure how to correctly input the table "IPaddr" into pingscript as a foreach from array...

I hope you can help me clearing this issue or correct me where I'm wrong :)

I can't post the code here, the site gives an error, so i posted on Pastebin: PHP script can be seen here