[eluser]zebake[/eluser]
Alright, back at it, wrapping my brain around this. I'm happy to hear I at least know how to ask questions
I took the variable out of my query and it is now displaying the student names correctly...Thank you jedd, and slowgary! I also added
Code:
return ($query->num_rows() > 0)? $query->result_array() : FALSE;
to check for NULL query results. And, I capitalized my model calls in my controller.
jedd, thank you for the database normalisation info. I will be reading up on this today. I fooled with the $this->data vs. $data but I couldn't figure out where all to change this without throwing errors. You're right, I am definitely table shy, although I think I now understand why more tables can equal better, as it leaves you with many more options down the line. I believe I am just scared of figuring out all the code to bring all of the tables together.
slowgary, thank you for pointing out the Profiler. I had read about that in the user guide, but hadn't thought of using it here. Very helpful! I also copied the database queries from the Profiler and plugged it into MySQL-Front (my mysql GUI). I can see how this will help me to be able to see what I am actually pulling from the database. Extremely helpful!
Believe it or not, I have another question. With my database, once I went from one table to three tables, I changed a few of my column names. Will I face problems with joining tables together that contain identically named columns? For instance, I now have a 'fname' column in both my students and parents tables, instead of 'parent_fname' and 'student_fname' (in their respective tables). If it's okay to have identically named columns in the two tables, how do I specify to echo the 'fname' from the parents table?
I'm modifying my mysql query now, to request all of the data from the parents table. I am calling all data from the students table with 'students.*' will there be a problem with calling all data from the parents table in the same manner?
example:
Code:
$query = $this->db->select('students.*, parents.*')