Welcome Guest, Not a member yet? Register   Sign In
Basic Database Help
#1

[eluser]r2ks[/eluser]
I am new to Codeigniter and would like some basic help.

I understand Model/controller/View
what i am struggleing with is understanding how to say pass simple data from a table to the View area.

Ok database clients ( table ) users
username
password
just example how would i get that basic info to show up in view passed by the controller from the data model.

Basic info please i want to learn this and undertsand better....
Thank you and God Bless
#2

[eluser]jedd[/eluser]
It sounds like you just need to work through some of the [url="/wiki/Category:Help::Tutorials"]tutorials[/url].
#3

[eluser]BrianDHall[/eluser]
You can also just go to the User Guide directly: http://ellislab.com/codeigniter/user-gui...views.html and http://ellislab.com/codeigniter/user-gui...ecord.html

Code:
$query = $this->db->get('users');

foreach ($query->result_array() as $user)
{
$content .= "<p>{$user['username']}</p>";
}

$data['content'] =& $content;

$this->load->view('user_view', $data);

And in the view in PHP code tags you just echo $content.
#4

[eluser]r2ks[/eluser]
Thank you that really helped,I am a Hands on learner and to have some code to work with in its basic form gives me a better understanding.
#5

[eluser]keld[/eluser]
Personaly I use the load vars to pass data so I can access my array everywhere:
Code:
$this->load->vars($data);
$this->load->view('template');




Theme © iAndrew 2016 - Forum software by © MyBB