Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.