Page 1 of 1

Switch exisiting to HTML MODE Need some help

Posted: Tue Jul 07, 2009 10:41 am
by bigbook
So, I have a mYSQL database, with the following
Name | phaseID

Example Input
name: gutierrez Phase: 2


I am trying to output a <B> tag in reference to it. I already did the mysql select ect. Is there a better way of outputting this?

ALSO: Here is the page in action:
http://summitld.com/project/viewtest.php?job=Coll

Here is the code

Code: Select all

<?php
        switch ($row['phaseID']) {
        ?>
          <th width="78" scope="row"><?php case 0:
          echo "<b>";?>
          Demolition<?php echo "</br>"; break; ?></th>
        </tr>
        <tr>
          <th scope="row"><font size=1>1</font> <?php case 1:
          echo "<b>";?>Grading + Excavation<?php echo "</br>"; break; ?></th>
        </tr>
        <tr>
          <th scope="row"><font size=1>2</font><?php case 2:
          echo "<b>";?> Drainage + sleeving<?php echo "</br>"; break; ?></th>
        </tr>
        <tr>
          <th scope="row"><font size=1>3</font> <?php case 3:
          echo "<b>";?>Cas lime + elec conduits<?php echo "</br>";  break; ?></th>
        </tr>
        <tr>
          <th scope="row"><font size=1>4</font><?php case 4:
          echo "<b>";?> Concrete Forms<?php echo "</br>";  break; ?></th>
        </tr>
        <tr>
          <th scope="row"><font size=1>5</font><?php case 5:
          echo "<b>";?> Drystack Walls<?php echo "</br>";  break; ?></th>
        </tr>
        <tr>
          <th scope="row"><font size=1>6</font> <?php case 6:
          echo "<b>";?>Concrete<?php echo "</br>"; break; ?></th>
        </tr>
        <tr>
          <th scope="row"><font size=1>7</font> <?php case 7:
          echo "<b>";?>Sprinkler System<?php echo "</br>"; break; ?></th>
        </tr>
        <tr>
          <th scope="row"><font size=1>8</font> <?php case 8:
          echo "<b>";?>Low VOltage Wiring<?php echo "</br>"; break; ?></th>
        </tr>
        <tr>
          <th scope="row"><font size=1>9 </font><?php case 9:
          echo "<b>";?>Masonry Work<?php echo "</br>"; break; ?></th>
        </tr>
        <tr>
          <th scope="row"><font size=1>10</font> <?php case 10:
          echo "<b>";?>Soil Preperation<?php echo "</br>"; break; ?></th>
        </tr>
        <tr>
          <th scope="row"><font size=1>12</font> <?php case 11:
          echo "<b>";?>1st Finish Grading<?php echo "</br>"; break; ?></th>
        </tr>
        <tr>
          <th scope="row"><font size=1>13</font><?php case 12:
          echo "<b>";?> Plantin<?php echo "</br>";  break; ?>g</th>
        </tr>
        <tr>
          <th scope="row"><font size=1>14 </font><?php case 13:
          echo "<b>";?>Final Finish Grading<?php echo "</br>";  break; ?></th>
        </tr>
        <tr>
          <th scope="row"><font size=1>15</font><?php case 14:
          echo "<b>";?> Weed Control<?php echo "</br>"; break; ?></th>
        </tr>
        <tr>
          <th scope="row"><font size=1>16 </font><?php case 15:
          echo "<b>";?>Tree Staking<?php echo "</br>"; break; ?></th>
        </tr>
        <tr>
          <th scope="row"><font size=1>17 </font><?php case 16:
          echo "<b>";?>Low voltage Lighting Fictures<?php echo "</br>"; break; ?></th>
        </tr>
        <tr>
          <th scope="row"><font size=1>18 </font><?php case 17:
          echo "<b>";?>Installation + Testing<?php echo "</br>"; break; ?></th>
        </tr>
        <tr>
          <th scope="row"><font size=1>19</font><?php case 18:
          echo "<b>";?> Mulching<?php echo "</br>"; break; ?></th>
        </tr>
        <tr>
          <th scope="row"><font size=1>20</font><?php case 19:
          echo "<b>";?> Lawn Installation<?php echo "</br>"; break; ?></th>
        </tr>
        <tr>
          <th scope="row"><font size=1>21 </font><?php case 20:
          echo "<b>";?>Clean-up Detail<?php echo "</br>"; break; } ?></th>
        </tr>

Re: Switch exisiting to HTML MODE Need some help

Posted: Tue Jul 07, 2009 10:52 am
by genconv
I don't now what are you trying to do.

If you want to bold a name you should make that this way:

Code: Select all

 
<tr>
        <th scope="row"><font size=1>19</font><?php case 18:
        echo "<b>";?> Mulching<?php echo "</b></br>"; break; ?></th>        
</tr>
 
If you want to achieve something else then post a replay.

Re: Switch exisiting to HTML MODE Need some help

Posted: Tue Jul 07, 2009 10:57 am
by genconv
Is there a better way of outputting this?
Of course! you should use a loop:

Code: Select all

<table>
<?php
foreach($result as $r){
 ?>
<tr>
       <td scope="row">
           <font size=1><?=  $r['Scope'] ?></font>
           <?=  $r['Name'] ?>
       </td>
</tr>
 
<?php
}
?>
</table>