Hello, I am trying to make an example in codeIgniter where I want to display data from the database in html forms.
This is my query:
$id_entidade = $this->session->userdata('id_entidade');
$query = $this->db->query("SELECT * FROM entidade where id_entidade = '$id_entidade'");
foreach ($query->result() as $row){
echo $row->nome;
echo $row->email;}
Here it is working right, now I would like to know how it shows there in html.
I tried to do this:
<?php foreach($query as $row): ?>
<input type="text" class="form-control" name="nome" placeholder="Nome" value="<?php echo $query->nome ;?>" />
<?php endforeach; ?>
But it's not working, could you give me tips? I'm starting the framework study, so if I'm very wrong, I'll accept improvement tips.
Thanks to whoever respond, hug.