Welcome Guest, Not a member yet? Register   Sign In
[Solved] Problem with ci4-adminlte
#3

(This post was last modified: 02-01-2021, 03:08 PM by chiabgigi.)

@InsiteFX
if you are referring to the code written in the first message, I apologize it is the translator's fault, in reality I don't have spaces.

i tried like this:
--Controller:
    public function index ()
    {
      / * $data ['users'] = $this->uModel->findAll ();
        return view ('crud/index', $data); * /
        return view ('crud/index', [
            'users' => $this->uModel->findAll(),
        ]);
    }
----------

--Page
    <div class = "container">
        <div class = "row">
            <div class = "col-md-10">
                <?php $users = array(); ?>
                <?php //if(count($users)> 0):?>

                <table class = "table">
                    <tr>
                        <th> Id </th>
                        <th> Name </th>
                        <th> Surname </th>
                        <th> Username </th>
                        <th> Email </th>
                        <th> Created </th>
                        <th> Modified </th>
                        <th> Pic </th>
                    </tr>
                    <?php foreach($users as $user): ?>
                        <tr>
                            <td><?= $user->id; ?> </td>
                            <td><?= $user->fname; ?> </td>
                            <td><?= $user->lname; ?> </td>
                            <td><?= $user->uname; ?> </td>
                            <td><?= $user->email; ?> </td>
                            <td><?= $user->created_at; ?> </td>
                            <td><?= $user->updated_at; ?> </td>
                            <td><?= $user->profile_pic; ?> </td>
                        </tr>
                    <?php endforeach; ?>
                </table>
                <?php // else:?>
                    <! - <h3> Sorry, no data found. </h3> ->
                <?php //endif; ?>
            </div>
        </div>
    </div>
-------------------

The error is gone, the table appears but not the data.
It cannot retrieve data from the database table.
Reply


Messages In This Thread
[Solved] Problem with ci4-adminlte - by chiabgigi - 02-01-2021, 04:54 AM
RE: Problem with ci4-adminlte - by InsiteFX - 02-01-2021, 12:38 PM
RE: Problem with ci4-adminlte - by chiabgigi - 02-01-2021, 02:07 PM
RE: Problem with ci4-adminlte - by InsiteFX - 02-01-2021, 09:47 PM
RE: Problem with ci4-adminlte - by chiabgigi - 02-01-2021, 11:49 PM
RE: Problem with ci4-adminlte - by chiabgigi - 02-02-2021, 02:33 AM



Theme © iAndrew 2016 - Forum software by © MyBB