CodeIgniter Forums

Full Version: how can i read just one field from a db table
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

hi there!.. basic stuff here again
i cant understand this
i just want to read only 1 field of my DB... the content of the Image from some ID

here is what i am doing

$this->db->where('id', $id);
$JustTheImage = $this->db->get('post');

but by the whole things i've try to readit the only one that works is just a forech
a foreach for a single thing has no sense

El Forum

you have to add
$result = $this->db->get('post');
$row = $result->row();
in php5 you can do
$this->db->select('image')->from('post')->where('id', $id)->get()->row()->image;

El Forum

now is working!.. thanks!