[PHP] nested statement problem
I am having a problem with a nested if statement in php. Everything works fine, but it doesn't display the information that I am trying to retrieve using a second if statement. CODE: if (($fr == 'FR') && ($xe == 'XE') && ($co == 'CO')) { print "Statement"; } elseif (($ag == 'AG') && ($rz == 'RZ') && ($sa == 'SA')) { print "Additional Statement"; if ($sr == 'SR') { print "More Info"; } print "Line continuation"; if (($rx == 'RX') && ($rj == 'RJ') && ($rr == 'RR') && ($rd == 'RD') && ($ra == 'RA')) { print "additional information"; } // Everything works except this nested if statement - No php error, it just doesn't display the information print ""; } else { print "other information if false"; } ENDCODE: Thanks in advance -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Trouble with arrays from within MySQL results where clause
Hello all, 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: -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Trouble with arrays from within MySQL results where clause
Nevermind, I figured it out. Simple case of duh... $data[] = array('$time' => '$time','$aval' => 'aval'); Should have been: $data[] = array('$time' => "$time" ,'$aval' => "aval"); Thanks. :) -Original Message- From: Eric Boerner [mailto:[EMAIL PROTECTED] Sent: Monday, July 12, 2004 9:06 AM To: [EMAIL PROTECTED] Subject: [PHP] Trouble with arrays from within MySQL results where clause Hello all, 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: -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php