[eluser]MMacdonald[/eluser]
I think there's more than a join problem going on here. Let's fix the other problems first. I always suggest you get the simplest query working intially, and then build it up to the one you want.
Your error message is telling you that $pmdata doesn't exist - which appears to be the case from the code you submitted. Follow this simple template for a single table, and let me know how you get on. If you get that far, we can look at joins with other tables:
In your model (which I've called example_model.php - the class is Example_model)
Code:
function select_item($id)
{
$this->load->database();
$this->db->select('*'); //get all table fields
$this->db->where('id',$id); //for the single item that matches the $id
$query = $this->db->get('example_db_table_name'); //pass the table name - you were missing this
//you might want to check that only 1 row was returned - add code later
return $query->result(); //I return the result, rather than the query object
}
In your controller:
Code:
$this->load->model('example_model');
$data['item']=$this->example_model->select_item($id);
$this->load->view('example_view',$data);
In your view (which I've called example_view.php - the class is Example_view)
Code:
//you only wanted one row - so you work with the first item in the result array
//if you had requested all rows in the table, you could use a nested loop to go through
//each element in each row
foreach ($item[0] as $fieldname)
{
echo $fieldname;
}
Let me know how you get on.
Mark