[eluser]Unknown[/eluser]
Hello codeigniter forum!
I'm working on this project where I need to make some join statements.
I'm quite new to codeigniter and how it works with sql, so doing this have proven quite a challenge for me.
This is my current model, which I am goning to use for a "homemade" search function.
Code:
<?php
class Search_model extends CI_Model{
public function __construct()
{
parent::__construct();
}
function search($searcharray)
{
$this->db->select('user_id, user_name, email, status');
$this->db->from('user');
$this->db->like('user_name', $searcharray , 'both');
$this->db->or_like('email', $searcharray, 'both');
$query = $this->db->get();
return $query->result();
}
}
?>
As it is now, it just searches the user table for a match on either the email or user_name field.
This is the tricky part, I have these three more tables I need to add this.
A table named "forum_comment" with the fields "forum_comment_id, user_id, forum_comment_dt, comment_content" selected
A table named "picture" with the fields "picture_id, picture_title, picture_description" selected
and last a table named "topic" with the fields "topic_id, topic_title, topic_content, user_id" selected.
If you have any ideas, maybe a solution for me. I would be a very happy upcomming multimediadesigner.
- Best regards Todac.