Jump to content

lynda.com tutorial


Recommended Posts

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

 

Link to comment
https://forums.phpfreaks.com/topic/206093-lyndacom-tutorial/
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/206093-lyndacom-tutorial/#findComment-1078355
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.