grandeclectus Posted June 28, 2010 Share Posted June 28, 2010 Hello, I am stuck with a Lynda.com tutorial: http://www.lynda.com/home/DisplayCourse.aspx?lpk2=435 Everything has worked perfectly up until this point. As soon as I add the second function to the functions.php file, it says the variable is undefined. I copied and rechecked everything the instructor said. This was the one hitch sofar. function get_all_subjects(){ $query = "SELECT * FROM subjects ORDER BY position ASC"; $subject_set = mysql_query($query, $connection); confirm_query($subject_set); return $subject_set; } This code worked perfectly when it was in the main php file. When I called the function: $subject_set = get_all_subjects(); The page no longer worked due to the $subject_set variable not being recognized. I went over it line by line, checked every iota, and the weird thing is that it worked fine until it was put over into the include file. Any suggestions? Thanks, Betsy Quote Link to comment Share on other sites More sharing options...
premiso Posted June 28, 2010 Share Posted June 28, 2010 Would love to help, but unfortunately no account and I am not willing to get a membership. The main thing that concerns me is what does confirm_query() do? If it does not return the variable as reference then your flaw is that $subject_set is never being set to a value. If it returns an item from the query / updates the subject, then you need to return it. But this is a fair bit of guess work and I do not know what confirm_query does. Quote Link to comment Share on other sites More sharing options...
grandeclectus Posted June 28, 2010 Author Share Posted June 28, 2010 Hello, Thanks. confirm_query(); sets up the connection between the website and the server. I appears to be a routine method for doing that and it does work. GE Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.