Welcome Guest, Not a member yet? Register   Sign In
howto get value of a column from a table
#1

[eluser]linderox[/eluser]
I want to take just a 'title' from the table if I have 'alias' unique value.
I use this way, but I think this problem has simpler solution than create an array
Code:
function gettitle($galleryalias)
{
    $this->db->select('title')->where('alias',$galleryalias);
    $query = $this->db->get('photostock_catg');
    if ($query->num_rows() > 0)
    {
        foreach ($query->result() as $row)
        return $row->title;
    }
    else
    {
        return FALSE;
    }
}
#2

[eluser]Thorpe Obazee[/eluser]
[quote author="linderox" date="1244025421"]I want to take just a 'title' from the table if I have 'alias' unique value.
I use this way, but I think this problem has simpler solution than create an array
Code:
function gettitle($galleryalias)
{
    $this->db->select('title')->where('alias',$galleryalias);
    $query = $this->db->get('photostock_catg');
    if ($query->num_rows() > 0)
    {
        // you only want one row then,
        return $query->row()->title;
    }
    return FALSE;
}
[/quote]
#3

[eluser]Dam1an[/eluser]
Bargain, you really shouldn't quote someone if you're going to change the code in their quote
I was just about to post the exact same thing as you did and then I realised you done it in disguise Tongue

(Also, what happened to the mean looking av?)
#4

[eluser]Thorpe Obazee[/eluser]
lol. (the dog wasn't mean-looking Tongue )
#5

[eluser]linderox[/eluser]
thank you




Theme © iAndrew 2016 - Forum software by © MyBB