[eluser]Stephen G[/eluser]
Hi
I am new to code ignitor, and PHP :bug: :wow:
I am returning a set of results and loop through the results to print out a name value pair...
But i can not figure out what the best way to approach this? :red:
Here is my code... I want to do something like this??...
Code:
$this->db->where('id_fields', $row->id_forms_fields);
$data['field'] = $this->db->get('fields');
foreach($data['field']->result() as $field) {
if($field->tagname == 'input') {
foreach($field->result() as $item) {
echo '"' $item['column'] . '" : "' $item['value'] . '"';
}
}
This is what my table looks like
Code:
____________________________________________________________________________________
ID | TAGNAME | TYPE | CLASS | ID | VALUE | TABINDEX | NAME |
=======================================================
1 | INPUT | Text | text | first_name | NULL | 1 | first_name |
=======================================================
2 | INPUT | Text | text | last_name | NULL | 2 | last_name |
=======================================================
Is there a way to loop through each item in a row and print out the column name and value in either codeignitor or PHP?
Sincerely,
Steve :cheese: