drakal30 Posted December 11, 2007 Share Posted December 11, 2007 I have a tricky problem that I can't seem to get my head around, Here is the code: $totCols = $totBanks / 58; <table class="toFloorMap" cellspacing="1"> <tr> <?php while($count <= $totCols) { ?> <td class="toFloorMapHead" style="width: 5%;"> Bank </td> <td class="toFloorMapHead" style="width: 5%;"> Vendor </td> <td class="toFloorMapHead" style="width: 23%;"> Location </td> <?php $count++; } ?> </tr> <?php $count = 1; while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) { if($count == 1) { ?> <tr> <?php } ?> <td class="toFloorMapData2"> <?php echo $line["bank"]; ?> </td> <td class="toFloorMapData2"> <?php echo formatVen($line["vendor"],1); ?> </td> <td class="toFloorMapData" style="text-align: left;"> <?php echo "(" . chgZone($line["zone"],1) . ") " . $line["genDesc"]; ?> </td> <?php if($count == 3) { ?> </tr> <?php $count = 1; }else { $count++; } } ?> </table> The above code words great creates a table with 3 sets of headers that read Bank, Vendor, Location. What it does not do is list the banks vertically like 1 6 2 7 3 8 4 9 5 10 Instead it is listing them horizontally 1 2 3 4 5 6 7 8 I would like it to list them horizontally, I can't seem to figure how I would about this without screwing up my format. Any ideas to point me in a direction to go about achieving this? Thanks. Quote Link to comment Share on other sites More sharing options...
phpQuestioner Posted December 11, 2007 Share Posted December 11, 2007 is this what you are trying to do? <table class="toFloorMap" cellspacing="1"> <tr> <?php $totCols = $totBanks / 58; while($count <= $totCols) { echo '<td class="toFloorMapHead" style="width: 5%;"> Bank </td> <td class="toFloorMapHead" style="width: 5%;"> Vendor </td> <td class="toFloorMapHead" style="width: 23%;"> Location </td>'; } ?> </tr> <?php $count="1"; while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) { if($count == 1) { echo '<td class="toFloorMapData2"> '. $line["bank"] .' </td> <td class="toFloorMapData2"> '. $line["vendor"] .' </td> <td class="toFloorMapData" style="text-align: left;">'; echo "(" . chgZone($line["zone"],1) . ") ". $line["genDesc"] .""; echo '</td></tr>'; } else if ($count == 3) { $count= "1"; } else { $count++; } } ?> </table> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.