PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
I am somewhat new to php I know some but not enough to do anything advanced.
I have a line of code that I would like to ignore a feild if that feild is Null. Say for instance in this code the feild G_Rank has a null entry, I want it to be excluded from the results that are printed out. Sorry if this is covered somewhere and I could read a post to get the answer. I just cannot seem to get this to work like I would want it to work.
// --------------------------------
// Now let's list all of the groups
$query = "
SELECT G_Rank, G_Id
FROM w3t_Groups
";
$sth = $dbh -> do_query($query);
// --------------------------------------------------------------------
// This gets somewhat confusing. Basically we are echoing out a table
// with 3 colums. When we are done listing the groups then we need
// to fill out the rest of the table with nbsp;
echo "<TABLE BORDER=0 WIDTH=\"95%\" ALIGN=\"center\">";
$row =0;
while ( list($Rank,$Id) = $dbh -> fetch_array($sth)) {
if ( ($Id < 5) && ($Id != 5)) { continue; }
if ($row == 0) { echo "<TR>"; }
$row++;
echo "";
// --------------------------------
// Now let's list all of the groups
$query = "
SELECT G_Rank, G_Id
FROM w3t_Groups
";
$sth = $dbh -> do_query($query);
// --------------------------------------------------------------------
// This gets somewhat confusing. Basically we are echoing out a table
// with 3 colums. When we are done listing the groups then we need
// to fill out the rest of the table with nbsp;
echo "<TABLE BORDER=0 WIDTH=\"95%\" ALIGN=\"center\">";
$row =0;
while ( list($Rank,$Id) = $dbh -> fetch_array($sth)) {
if ( ($Id < 5) && ($Id != 5)) { continue; }
if ($row == 0) { echo "<TR>"; }
$row++;
echo "";
echo " <b>$Rank</b>";
echo "";
}
$dbh -> finish_sth($sth);