Jump to content

problem using a url variable in a sql statement


Recommended Posts

I have a page where a user can make a selection from a list box of an instructor. Once the selection is made, the instructor key is passed into the URL variable.

 

The next page that displays is supposed to only display courses that the instructor has listed in the database. If I take the variable out of the WHERE statement, I can place a literal in it's place and get the correct data. When I place the variable in the WHERE my page to display the courses fails. If I take out the where entirely, then I am able to display all courses stored in the table.

 

The next step to this is to allow the user to select the course and then display a roster. I am using a GET on all my forms and creating a hidden field called instructorKey with the value of $HTTP_GET_VARS['instructorKey']. In my record set the variable is called colname with a runtime value of $HTTP_GET_VARS['instructorKey'].

 

I know there has to be something simple that I'm leaving off to pass the data down based on the variable.

 

Here is my SQL statement:

 

SELECT TRAINING_COURSE.coursename, TRAINING_SCHEDULE.schedulestartdate

FROM TRAINING_INSTRUCTOR INNER JOIN (TRAINING_COURSE INNER JOIN (TRAINING_ATTENDEE INNER JOIN TRAINING_SCHEDULE ON TRAINING_ATTENDEE.ScheduleKey = TRAINING_SCHEDULE.ScheduleKey) ON TRAINING_COURSE.CourseKey = TRAINING_SCHEDULE.CourseKey) ON TRAINING_INSTRUCTOR.InstructorKey = TRAINING_SCHEDULE.InstructorKey

WHERE TRAINING_INSTRUCTOR.InstructorKey = colname

 

Link to comment
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.