CodeIgniter在Html的每个实例上迭代输出的行

时间:2012-03-07 23:06:06

标签: php mysql html codeigniter

我无法输出<?php $row->entryData; ?></td>。如果我在数据库中有两行,我需要它来迭代Html的每个实例。尽管如此,它并没有这样做。它输出一个框中的所有行。如何在正确的方框中输出?

<?php   $userid = $this->session->userdata('userid');
        $query  = $this->db->query("SELECT * FROM churchMembers WHERE cMuserId = '{$userid}'");
        $row = $query->row();
        $membersChurchId = $row->cMchurchId;
        $query = $this->db->query("SELECT wp.entryData, wp.entryCreationDateTime, u.firstname, u.lastname, u.userid, u.defaultImgURI FROM users u
                                   INNER JOIN wallPosts wp ON wp.postingUserid = u.userid
                                   WHERE wp.wpChurchId = '{$membersChurchId}'");

        foreach ($query->result() as $row) { ?>
            <table cellpadding="0" cellspacing="0" style="width: 500px; height: 107px" align="left">
                <td valign="top" style="padding: 3px; width: 101px;" rowspan="2">
                    <img id="defaultImg a0" src="<?php echo base_url().$row->defaultImgURI; ?>" width="95" height="96" /></td>
                    <td valign="top" class="style1" style="width: 124px">
                        <a class="font1"><?php echo $row->firstname . " " . $row->lastname; ?></a>
                    </td>

                    <td valign="top" class="right-align-button1" style="height: 35px; width: 269px;">
                        <a class="link-font1" id="like" href="#" style="width: 138px">Like</a> </span>
                        <span class="font2"> | </span>
                        <a id="comment" href="#" style="width: 138px" class="link-font1">Comment</a><br />
                        <span class="font2"><?php echo $row->entryCreationDateTime; ?></span>
                    </td>

                <tr>
                    <td valign="top" colspan="2" style="height: 72px">
                    <?php $row->entryData; ?></td>
                </tr>
            </table>
<?php } ?>

1 个答案:

答案 0 :(得分:2)

我想你必须改变:


<?php $row->entryData; ?>


<?php echo $row->entryData; ?>  //you missed echo i guess

如果您的代码中有其他一切正常。