Re: please help!

From: Date: Tue, 23 Apr 2002 19:12:25 +0000
Subject: Re: please help!
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-18762@lists.php.net to get a copy of this message
You're not evaluating the variable correctly... Instead of... $site = ".row['site']."; It should be... $site = $row["site"]; Or $site = "$row['site']" I'm not sure why you have leading and trailing periods, either. Looks like you were trying to do string appends, but they're not being used correctly.... 'Luck -Szii ----- Original Message ----- From: "Evans, Josh" <Josh.Evans@acs-inc.com> To: <php-db@lists.php.net> Sent: Tuesday, April 23, 2002 11:26 AM Subject: [PHP-DB] please help! > 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 > > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php

« previous php.db (#18762) next »