Multiple "if()" statements

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I have a table with lots of fun information in it.  For one of the pages 
that I am working on, I want to display a list of names based on what is in 
the DB.
  My $SQL statement works great and has pulled in values for "first_name," 
"hs_last_name," and "last_name" in that order.  Right now, I am just 
printing to the screen the results of "first_name (hs_last_name) last_name" 
but there are two problems with this...
  The first problem is men's names and unmarried women's names...  they will 
have the same "hs_last_name" and "last_name" so I don't want the duplicate 
displaying on the page.
  The second problem is the entry of the word "none" by some of the visitors 
in place of a "hs_last_name"...  obviously I don't want to display this 
either.
  The following is the string of "IF()" statements that I am using, but I 
have an issue with my syntax somewhere because it isn't working the way I 
want.  Any help would be great!


  if($row[1]="none") {
  print("<tr>");
  print("<td>$row[0] $row[2]</td>");
  print("</tr>");
  } else
  if($row[1]=$row[2]) {
  print("<tr>");
  print("<td>$row[0] $row[2]</td>");
  print("</tr>");
  } else
     print("<tr>");
  print("<td>$row[0] ($row[1]) $row[2]</td>");
      print("</tr>");

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux