array/mysql problems

From: Date: Tue, 31 Jul 2001 03:48:29 +0000
Subject: array/mysql problems
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-60307@lists.php.net to get a copy of this message
I've been trying to get this to work all night with no luck. I've gotten a similar version to work, with the only real difference being I didn't use mysql (I just plugged some stuff in). But other than that I can't see the difference. Basically I'm trying to pull stuff out of a database, get an average for each entry, and then sort the entries by the average from largest to smallest. I don't get any output other than the basic html in other parts of the file. No error messages. I've tried sticking in echos all over the place testing stuff looking for the problem and I can't find anything. Any ideas? $link = mysql_connect("host", "user", "pass"); mysql_select_db("db"); $result = mysql_query("SELECT * FROM table"); $sitearray = array(); $dummysite = new siteinfo(); //siteinfo is a class containing just variables while ($query_data = mysql_fetch_object($result)) { $dummysite->days = (int)((time() - $query_data->startday)/86400); if ($dummysite->days < 1) $dummysite->days = 1; $dummysite->sitename = $query_data->sitename; $dummysite->tvisits = $query_data0->visits; $dummysite->avisits = $dummysite->tvisits/$dummysite->days; $sitearray[$dummysite->avisits] = $dummysite; } echo "<tr><td>"; $sitearray = array_reverse($sitearray); //just trying to get some output, any output for ($i = 1; $i != 100; $i++) echo $sitearray[$i]->sitename; thanks, Matt

« previous php.general (#60307) next »