Grae Wolfe - PHP wrote:
> ...
> 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>");
> 

Indenting is your friend, indented version of what you had.

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>");

The bigest problem with the above is that both the else becomes unclear
when they finish due to the lack of {}.
The ifs should also be using an == instead of an =, you want to compare
not assign.

I'm also going to throw in an elseif for fun, to get this (hopefully)
improved version:

if($row[1] == "none") {
   print("<tr>");
   print("<td>$row[0] $row[2]</td>");
   print("</tr>");
} elseif($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

Reply via email to