I'm trying to create a system more dynamic for my users, implementing a way of they create each necessary information when they needed. (Sorry if my english is weak)
First, I have a table named User, like this:
User:
id   |   name   |    login   |     password
1    |   Rose   |  rose.120  |     897763
2    |   John   |  john.red  |     120347
3    |   Mark   |  mark.foo  |     385598
and the other table with some info of each user:
User_info:
id  |  user_id  |  info_name      |   value          |  required  |  order
6   |   1       | Telephone       |  555-4083        |   yes      |   2 
7   |   1       | Email           |  rose.120@g.com  |   yes      |   1 
8   |   1       | Another E-mail  |  rose.mg@fc.com  |   no       |   3 
When I get this values from the database, how make an efficient way to set a PHP Object, or an Array of this values.
I tried to make a mysql_query and with this result make a loop in the Object, and for any Row make a WHERE clause to the user id. (I'm using CodeIgniter)
    if( $user != false ) $this->getUser();
    foreach( $this->user->result() as $row ) {
        $this->db->where('user_id', $row->id);
    }
    $this->db->from('user_info');
     ...
and when I have this Object I will need to put the User_info rows in the User Object. Correct?
I'm just curious if this is a good way of doing this, or I'm in the wrong way.
I hope that's clear.
Thanks.
 
     
     
     
    