douliang7068
douliang7068
2015-05-26 19:16
浏览 13
已采纳

使用bootstrap与PHP

I use bootstrap to make my site resopnsive and i have this table i fill with data from a webservice but my class container dont work now and i dont kow why.. Is it the php code that messup the boostrap or is it something i have done wrong?

<!--Tabell visa personal-->
    <div class="container">
    <div class="pull-left">
            <h1 class="regHead">Tabell för all personal</h1>
            <table class="table" id="speltabell">
                <thead>
                    <tr>
                        <th>Personnummer</th>
                        <th>Förnamn</th>
                        <th>Efternamn</th>
                        <th>Adress</th>
                        <th>Postnr</th>
                        <th>Ort</th>
                        <th>Hemtelefon</th>
                        <th>Mobil</th>
                        <th>Mail</th>
                    </tr>
                </thead>
            <tbody>       
    <?php 
    try
    {
        $soap_client = new
        soapclient("http://tsb01.cnap.hv.se/PersonalService/ServicePersonal.svc?wsdl");      
        $result = $soap_client->HamtaAllPersonal();
        var_dump($result);
        foreach ($result->HamtaAllPersonalResult->AllPersonal as $person) 
        {
        echo "<tr />";
        echo "<td>$person->PnrPersonal</td>";
        echo "<td>$person->FornamnPersonal</td>";
        echo "<td>$person->EfternamnPersonal</td>";
        echo "<td>$person->AdressPersonal</td>";
        echo "<td>$person->PostnrPersonal</td>";
        echo "<td>Bjas</td>";
        echo "<td>$person->HemtelefonPersonal</td>";
        echo "<td>$person->MobiltelefonPersonal</td>";
        echo "<td>$person->MailPersonal</td>";

        }    

    }
    catch(SoapFault $exception)
    {
        echo $exception->getMessage();
    }
    ?>
                    </tbody>
                </table>
        </div> <!--Slut tabell-->
        </div>
  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • dongyouji7022
    dongyouji7022 2015-05-26 19:50
    已采纳

    Replace the content in you foreach loop with this and learn HTML better:

    foreach ($result->HamtaAllPersonalResult->AllPersonal as $person) 
        {
        echo "<tr>";
        echo "<td>$person->PnrPersonal</td>";
        echo "<td>$person->FornamnPersonal</td>";
        echo "<td>$person->EfternamnPersonal</td>";
        echo "<td>$person->AdressPersonal</td>";
        echo "<td>$person->PostnrPersonal</td>";
        echo "<td>Bjas</td>";
        echo "<td>$person->HemtelefonPersonal</td>";
        echo "<td>$person->MobiltelefonPersonal</td>";
        echo "<td>$person->MailPersonal</td>";
        echo "</tr>";
        }
    
    点赞 评论

相关推荐