خرید بک لینک

Vote count: 0

I currently have 2 tables in which I need to get data from.

My users table looks like: ID first_name last_name useame

My data table looks like: ID filename doctoame viewed

What I need to do match the first name and last name from the users table to the doctor name in the data table and the retu the "filename" and "viewed" rows from this.

I can't seem to get the query right for it though. I'm using the active record class with code igniter. Ive also tried to have a separate function that concats the first and last name and retus it but I can't seem to pass that variable to the join section of the query.

  $avail = '1';
    $this->db->select('*');
    $this->db->from("users a");
    $this->db->where("useame",$useame);
    $this->db->where('CONCAT(first_name, '.', last_name) AS doctoame', FALSE);


    $this->db->join('data b', "doctor name = b.doctorName", "left");

    $result = $this->db->get();
    // print_r($this->db->last_query());
    retu $result->result();

Anyone know whats going wrong? Thanks

asked 29 secs ago

برچسب: نویسنده: استخدام کار تاريخ: چهارشنبه 2 تير 1395 ساعت: 20:11

صفحه بندی