#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2003
    Posts
    2
    Rep Power
    0

    passing information


    Hi,

    I have a drop down menu that pulls information based on option selected:

    <%
    varClass = Request.QueryString("classname")
    %>

    ...
    <OPTION VALUE="index3.asp?classname=Leadership Excellence Phase I">Leadership Excellence Phase I</option>

    I'm using classname instead of classid because I have several classes with the same name but different ids (diff dates).

    Once a user selects an option from there they should be able to enroll and/or view a roster of those already enrolled. If I hardcode the value for one particular class everything comes up perfectly. Since I want to do this dynmaically based on on the classname how do I use the variable correctly in my select statement?

    Here what I have so far and I tried the following:

    mySQL="SELECT c.classID, c.className, c.classDate, c.maxEnroll, count(e.enrollID) as enrolled "&_
    "FROM classTable c "&_
    "LEFT JOIN enrollTable e ON c.classID = e.classID "&_
    "WHERE c.className = 'Leadership Training Phase I' "&_
    "GROUP BY c.classID, c.className, c.classDate, c.maxEnroll"

    I've tried:

    mySQL="SELECT c.classID, c.className, c.classDate, c.maxEnroll, count(e.enrollID) as enrolled "&_
    "FROM classTable c "&_
    "LEFT JOIN enrollTable e ON c.classID = e.classID "&_
    "WHERE c.className = '" & classname & "' "&_
    "GROUP BY c.classID, c.className, c.classDate, c.maxEnroll"

    STILL NOT WORKING...HELP!


    I've also tried:

    mySQL="SELECT c.classID, c.className, c.classDate, c.maxEnroll, count(e.enrollID) as enrolled "&_
    "FROM classTable c "&_
    "LEFT JOIN enrollTable e ON c.classID = e.classID "&_
    "WHERE c.className = "' & Request.QueryString "className") '""&_
    "GROUP BY c.classID, c.className, c.classDate, c.maxEnroll"

    This also doesn't work. This should be simple but I need help!
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2000
    Location
    USA
    Posts
    226
    Rep Power
    14

    try


    Try: WHERE c.className = '" & varClass & "' "&_ or

    WHERE c.className = "' & Request.QueryString("className") '""&_
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2003
    Posts
    2
    Rep Power
    0

    thanks!


    The following actually worked:

    mySQL="SELECT c.classID, c.className, c.classDate, c.maxEnroll,count(e.enrollID) as enrolled "&_
    "FROM classTable c "&_
    "LEFT JOIN enrollTable e ON c.classID = e.classID "&_
    "WHERE c.className = '" & Request.Querystring("className") & "'"&_
    "GROUP BY c.classID, c.className, c.classDate, c.maxEnroll"

IMN logo majestic logo threadwatch logo seochat tools logo