Database: sites

I have to columns: "id" and "site". I will have approx 800 entries in the db
when I am finished and what I want it to do and start with 1st entry and
ping the site and display in a table on the screen if it was able to ping
site or not.

This is what I have so far. My problem is I am not sure how to make it
select a entry, perform the ping, record the results, and then continue to
the next entry.

$db = mysql_connect("localhost","","") or die("Problem connecting");
mysql_select_db("josh") or die("Problem selecting database");
$query = "SELECT * FROM josh.sites";
$result = mysql_query($query) or die ("Query failed");
$numofrows = mysql_num_rows($result);
for($i = 0; $i < $numofrows; $i++) {
    $row = mysql_fetch_array($result);
    if($i % 2) { //this means if there is a remainder

    $site = ".row['site'].";   <---- its not pulling a site from the

    $host1 = `ping -n 4 $site`;

if (eregi("reply", $host1)) {
    echo "$site is up!";
} else {
echo ("$site is down!");

echo ("<p>");

Please Help!

Josh Evans

PHP Database Mailing List (
To unsubscribe, visit:

Reply via email to