I forgot to show you some output from this thing...

---{0,BLOW, JOE}---Name is BLOW, JOE, Key = 0 | 
---{Name,BLOW, JOE}---Name is BLOW, JOE, Key = Name | 
---{1,YES}---1 | 
---{2,}---
---{3,YES}---3 | 

The way I see it, that first line should have not printed because $key is
equal to 0 not "Name".


On Tue, 23 Apr 2002, John S. Huggins wrote:

>-
>-I have a problem.
>-
>-I am fetching rows from a MySQL table called "temp."  Each row has four
>-fields: "Name", "1", "2" and "3"
>-
>-Then I do this function which will eventually generate records for a
>-lookup table for any skills in the 1, 2 or 3 fields that equal the string
>-"YES" associated with the Name (right now it just prints to the web
>-browser while I debug it).
>-
>-function generateLookupTable() {
>-      //
>-      $query  = "SELECT * FROM temp";
>-      if ( !$result = mysql_query($query) ) {
>-              //
>-              print("<p>mysql_error() .  "<br>$query</p>"); 
>-      } else {
>-              //
>-              // For each name returned, march through
>-              // each skill and insert a row into the
>-              // lookup_skill
>-              // where the skill value == "YES"
>-              while ( $row = mysql_fetch_array($result) ) {
>-                      //
>-                      print("<p>"); // For test
>-                      while ( list($key,$value) = each($row) ) {
>-                              print("---\{$key,$value}---"); // For test
>-                              //
>-                              if ( $key == "Name" ) { <<<<<<<<-----
>-                                      print("Name is $value, Key = $key
>-| ");
>-                              } else {
>-                                      if ( $value == "YES" ) {
>-                                              print("$key | ");
>-                                      }
>-                              }
>-                              print("<br>");
>-                      }
>-                      print("</p>"); // For test
>-              }
>-      }
>-}
>-
>-
>-
>-I have marked an IF statement with the "<<<<<<<-----" string.  As the
>-while statement marches through the array $row returned from
>-mysql_fetch_array the value of key is set first to "0" then "Name" then
>-"1" then "2" then "3".  Fine.  However, the if statement highlighted above
>-winds up being "true" when the $key == 0 and when $key == "Name" and I
>-can't see why this would be so.
>-
>-Any possibilities folks?  I am quickly working around this now so it is
>-not slowing me down, however, this is just too unusual to not figure out.
>-
>-John
>-
>-
>-**************************************
>-
>-John Huggins
>-VANet
>-
>[EMAIL PROTECTED]
>-http://www.va.net/
>-
>-**************************************
>-
>-
>-
>--- 
>-PHP General Mailing List (http://www.php.net/)
>-To unsubscribe, visit: http://www.php.net/unsub.php
>-

**************************************

John Huggins
VANet

[EMAIL PROTECTED]
http://www.va.net/

**************************************


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to