andrew has asked for the wisdom of the Perl Monks concerning the following question:
Now if there are no results forprint qq~ <p><b>Shopping Cart Manager</b></p> <table align="center" width="370" cellpadding="0" cellspacing="0"> <td colspan="4"> <table align="center" width="370" cellpadding="4" bgcolor="black +" cellspacing="1"> <tr> <td class="text" bgcolor="#3399FF" width="200" align="center"> <b>Category</b> </td> <td class="text" bgcolor="#3399FF" width="50" align="center"> <b>Sub</b> </td> <td class="text" bgcolor="#3399FF" width="50" align="center"> <b>Item</b> </td> <td class="text" bgcolor="#3399FF" width="70"> </td> </tr> ~; if($id) { $sth = $dbh->prepare("SELECT id,name FROM category WHERE parent = ' +$id'"); $sth->execute or die $dbh->errstr; } else { $sth = $dbh->prepare("SELECT id,name FROM category WHERE parent = ' +0'"); $sth->execute or die $dbh->errstr; } while ( @slog = $sth->fetchrow_array ) { $sth2 = $dbh->prepare("SELECT id,name FROM category WHERE parent = + '$slog[0]'"); $sth2->execute or die $dbh->errstr; $rv = $sth2->rows; $subs = $rv; $sth3 = $dbh->prepare("SELECT category FROM items WHERE category = + '$slog[0]'"); $sth3->execute or die $dbh->errstr; $rv = $sth3->rows; $subs2 = $rv; print qq~ <tr> <td bgcolor="#FFFFFF" class="darktext" width="200"> <a href="admin.cgi?go=cart&id=$slog[0]">$slog[1]</a> </td> <td bgcolor="#FFFFFF" class="darktext" width="50"> $subs </td> <td bgcolor="#FFFFFF" class="darktext" width="50"> $subs2 </td> <td align="center" bgcolor="#FFFFFF" class="darktext" width="7 +0"> ~; if($id){ print qq~ <a href="admin.cgi?cart=settings&id=$slog[0]&otherid +=$id">settings</a> ~; } else { print qq~ <a href="admin.cgi?cart=settings&id=$slog[0]">settin +gs</a> ~; } print qq~ </td> </tr> ~; } print qq~ </table> </td> </tr> </table><br> ~;
Then I dont want it to printif($id) { $sth = $dbh->prepare("SELECT id,name FROM category WHERE parent = ' +$id'"); $sth->execute or die $dbh->errstr; } else { $sth = $dbh->prepare("SELECT id,name FROM category WHERE parent = ' +0'"); $sth->execute or die $dbh->errstr; }
print qq~ <p><b>Shopping Cart Manager</b></p> <table align="center" width="370" cellpadding="0" cellspacing="0"> <td colspan="4"> <table align="center" width="370" cellpadding="4" bgcolor="black +" cellspacing="1"> <tr> <td class="text" bgcolor="#3399FF" width="200" align="center"> <b>Category</b> </td> <td class="text" bgcolor="#3399FF" width="50" align="center"> <b>Sub</b> </td> <td class="text" bgcolor="#3399FF" width="50" align="center"> <b>Item</b> </td> <td class="text" bgcolor="#3399FF" width="70"> </td> </tr> ~;
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: If no results come back ...
by ehdonhon (Curate) on Jul 21, 2002 at 02:29 UTC | |
by andrew (Acolyte) on Jul 21, 2002 at 03:17 UTC | |
by ehdonhon (Curate) on Jul 21, 2002 at 03:31 UTC | |
Re: If no results come back ...
by screamingeagle (Curate) on Jul 21, 2002 at 03:21 UTC | |
by andrew (Acolyte) on Jul 21, 2002 at 03:31 UTC | |
by Anonymous Monk on Jul 21, 2002 at 03:52 UTC | |
by andrew (Acolyte) on Jul 21, 2002 at 04:18 UTC | |
by rdfield (Priest) on Jul 21, 2002 at 09:52 UTC |