Welcome Guest, Not a member yet? Register   Sign In
Print the field name, and its value
#1

[eluser]gh0st[/eluser]
I have a really big table, and I don't want to be doing:

Code:
print "Name: " . $row->name
print "Age: " . $row->age
print "Salary: " . $row->salary
// ...etc..

I want to do:

Code:
print $field->name;
print $field->value;

// output: name: John
// output: age: 32
// output: salary: 1000
// etc

I've looked at $this->db->field_data() but there is no $this->db->field_value attribute.

Is there a way to do this?
#2

[eluser]edwa5823[/eluser]
Will something like this work for you? Either you can print everything in a loop or assign some new variables for each.

Code:
foreach($row as $key => $value) {
   print "$key = $value\n";
}




Theme © iAndrew 2016 - Forum software by © MyBB