[eluser]Bhavani Shekhawat[/eluser]
site Controller
Code:
function show_my_artifacts() // Displays artifacts entered by me
{
$this->members_area();
$this->load->model('artifact_model');
$data['values'] = $this->artifact_model->fetch_myArtifacts();
$this->load->view('display_myartifacts', $data);
}
}
artifact_model Model
Code:
function fetch_myArtifacts(){
$get_userID_session = $this->session->userdata('username');
$query = $this->db->query("SELECT artifact.ArtifactName, artifact.ArtifactID, artifact.EnteredDate,
ca_table.username FROM artifact,ca_table WHERE ca_table.ArtifactID = artifact.ArtifactID AND
ca_table.username = '$get_userID_session'
");
if ($query->num_rows() > 0){
foreach ($query->result() as $rows)
{
$data[] = $rows;
}
return $data;
}
else
{
return false;
}
}
display_myartifacts view
Code:
<p> Your Artifacts </p>
<? foreach ($row as $r): ?>
<? echo $r->ArtifactName; ?>
<? endforeach; ?>
I dont know why I am not getting any query data on my view page. If I straight away display results in the model function it works but thats not what I want. I guess I am making some mistake in passing the data into the view in my controller. May be you people can help me out. Peace!