How to show the data from db table in my single pages
Permalink 2 users found helpful
Hi
I am developing web application using C5
I have the problem, how to show the data from database table in single pages.
After getting the data from controller by following code
controller:
Single pages
i attached cli.png its showing empty table,
How to solve and where i did wrong?
Any one give the idea how to do this?
thanks
Kumar
I am developing web application using C5
I have the problem, how to show the data from database table in single pages.
After getting the data from controller by following code
controller:
public function on_start(){ Loader::model('clientinfo'); $cldt = clientinfo::get(); $this->set('cldt',$cldt);
Single pages
<?php foreach($cldt as $data){ echo("<tr><td>$data[0]</td><td>$data[1]</td><td>$data[2]</td><td>$data[3]</td><td>$data[4]</td><td>$data[5]</td></tr>"); } ?>
i attached cli.png its showing empty table,
How to solve and where i did wrong?
Any one give the idea how to do this?
thanks
Kumar
No man the same empty table only show.
If you print the $cldt variable into controller, is it showing the array?
yeah its showing like this attachment. pfa
Ohhh.. Your array index is not like [0], [1].. It will be like [c_id], [c_name] ....
Rony
Rony
Hi @shankumar...
I saw your attachment...
I agree with Rony... Your array index should be like [c_id], [c_name].
I saw your attachment...
I agree with Rony... Your array index should be like [c_id], [c_name].
thanks rony and cjramki
this code properly work
yeah i got output...
thanks
Kumar
this code properly work
echo "<tr><td>".$data[c_id]."</td><td>".$data[c_company_name]." </td><td>".$data[c_rep_name]."</td><td>".$data[c_email]." </td><td>".$data[c_contact_no]."</td><td>".$data[c_sec_contact_no]." </td></tr>";
yeah i got output...
thanks
Kumar
Rony