On Tuesday 13 July 2004 00:05, Eric Boerner wrote: > I am having trouble setting array data from within a MySQL results > query. I have modified data from the result and wish to enter it into > it's own array ($data). That then is used to generate a graph. The > following code basically gives me an empty array... > > I am pulling out a timestamp and signal strength from a live data stream > to chart how strong a tower's signal is during the day. The data streams > once a minute from several sources. I compare each incoming signal with > the if statement and keep the highest signal strength. Each row is then > put into the new array. > > CODE: > > $data = array(); > while ($row1 = mysql_fetch_row ($queryexe1)){ > > $datetime = $row1[2]; > $sig1 = $row1[3]; > $sig2 = $row1[6]; > $sig3 = $row1[9]; > list($date,$time) = explode(" ",$datetime); > if ($sig1 > "-150") { $aval = "$sig1"; } > if ($sig2 > "-150") { $bval = "$sig2"; } if ($bval > $aval) > {$aval = bval;} > if ($sig3 > "-150") { $bval = "$sig3"; } if ($bval > $aval) > {$aval = $bval;} > > $data[] = array('$time' => '$time','$aval' => 'aval'); > > $aval = "-999"; > > } > $graph->SetDataValues($data); > > END CODE:
1) print_r() ALL variables of interest, in particular $data - I think you'll find that it doesn't contain what you expect. 2) Read manual > Types > Strings, to find out the difference between enclosing a string in single-quotes and double-quotes. -- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * ------------------------------------------ Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general ------------------------------------------ /* The biggest difference between time and space is that you can't reuse time. -- Merrick Furst */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php