Welcome Guest, Not a member yet? Register   Sign In
SOLVED::I WANT TO DISPLAY THE COURSE NAME
#5

[eluser]charlesmudy[/eluser]
[quote author="ηυмвєяσηє" date="1306416823"]please fix the title, Its so ugly.

About your problem, you should change your sql query. Something like this :
Code:
$q = "SELECT student.first_name, student.last_name, student.status_id, student.nationality_id, courses.name FROM student, courses WHERE student.course_id = courses.id"
[/quote]

I tried it but still not working.

My controller:

Quote:public function get_student()
{
$id = $this->uri->segment(3);
$data['query'] = $this->db->query("SELECT firstname, lastname, status_id, nationality_id, course_name FROM students, courses WHERE course_id = courses.id");
$this->load->view('student_view', $data);
//echo site_url("http://localhost/database/index.php/students/student_view");
}

My view:
Quote:&lt;?php echo "Course: " . " " . $row->course_id; ?&gt;<br />
&lt;?php echo "Nationality: " . " " . $row->nationality_id; ?&gt;


Error message:
Quote:Personal Data Information for John

First-name: John
Last-name: Baptise
Status: 0
A PHP Error was encountered

Severity: Notice

Message: Undefined property: stdClass::$course_id

Filename: views/student_view.php

Line Number: 11

Course:
Nationality: 3


Messages In This Thread
SOLVED::I WANT TO DISPLAY THE COURSE NAME - by El Forum - 05-26-2011, 02:18 AM
SOLVED::I WANT TO DISPLAY THE COURSE NAME - by El Forum - 05-26-2011, 02:33 AM
SOLVED::I WANT TO DISPLAY THE COURSE NAME - by El Forum - 05-26-2011, 02:39 AM
SOLVED::I WANT TO DISPLAY THE COURSE NAME - by El Forum - 05-26-2011, 03:21 AM
SOLVED::I WANT TO DISPLAY THE COURSE NAME - by El Forum - 05-26-2011, 06:43 AM
SOLVED::I WANT TO DISPLAY THE COURSE NAME - by El Forum - 05-26-2011, 06:59 AM



Theme © iAndrew 2016 - Forum software by © MyBB