Re: please help!
| From: | Ray Hunter | Date: | Wed, 24 Apr 2002 03:28:05 +0000 |
| Subject: | Re: please help! | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-18768@lists.php.net to get a copy of this message | ||
Also try using the exec command with an array and that will provide the
result for you so you can verify if the command was successful using php...
Check here: http://www.php.net/manual/en/function.exec.php
BigDog
"Josh Evans" <Josh.Evans@acs-inc.com> wrote in message
news:F9FE25DF0354D344B1FC7727CD5BD7D92AE1E5@acsakrexu01.acs.roadway.com...
> 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
> database?
>
>
> $host1 =
ping -n 4 $site;
>
> if (eregi("reply", $host1)) {
> echo "$site is up!";
> } else {
> echo ("$site is down!");
> }
>
> echo ("<p>");
> ?>
>
> Please Help!
>
> Josh Evans
>
>