dongliuzhuan1219 2014-08-31 18:20
浏览 47
已采纳

PHP回显结果成表[关闭]

I am struggling to put the data that is pulled from my database into a table layout.

This is the echo result:

echo "<p><h3>".$results['ID Number']."</h3>".$results['id_number']."</p>";
            echo "<p><h3>".$results['Card Status']."</h3>".$results['card_status']."</p>";
            echo "<p><h3>".$results['Full Name']."</h3>".$results['full_name']."</p>";
            echo "<p><h3>".$results['DBS/CRB Number']."</h3>".$results['dbs_number']."</p>";
            echo "<p><h3>".$results['Job Title']."</h3>".$results['job_title']."</p>";
            echo "<p><h3>".$results['Card Start Date']."</h3>".$results['card_start_date']."</p>";
            echo "<p><h3>".$results['Card Expiry']."</h3>".$results['card_expiry_date']."</p>";
            echo "<img src='photos/".$results['photo_name']."'>";

Please can someone help me, its driving me crazy, also the Name of the result isn't showing, e.g. 'ID Number' as a title then 'id_number' result.

or is there an easier way to show all the data from the record rather than having multiple echo's

I have a search box to find a record matching the id_number and then the data connected to a id_number is then shown

  • 写回答

2条回答 默认 最新

  • dongwuge6201 2014-08-31 18:34
    关注

    Well I dont think there was any help needed , still for the sake of your blockade use this as

    echo "<table><tr><td><h3>ID Number</h3></td><td>".$results['id_number']."</td></tr>";
                    echo "<tr><td><h3>Card Status</h3></td><td>".$results['card_status']."</td></tr>";
                    echo "<tr><td><h3>Full Name</h3></td><td>".$results['full_name']."</td></tr>";
                    echo "<tr><td><h3>DBS/CRB Number</h3></td><td>".$results['dbs_number']."</td></tr>";
                    echo "<tr><td><h3>Job Title</h3></td><td>".$results['job_title']."</td></tr>";
                    echo "<tr><td><h3>Card Start Date</h3></td><td>".$results['card_start_date']."</td></tr>";
                    echo "<tr><td><h3>Card Expiry</h3></td><td>".$results['card_expiry_date']."</td></tr>";
                    echo "<tr><td></td><td><img src='photos/".$results['photo_name']."'></td></tr></table>";
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?