user defined variable from php to mysql statement

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jjeanj1
    New Member
    • May 2007
    • 18

    user defined variable from php to mysql statement

    I am having issue using a user defined variable i an a mysql statement.
    here is the issue that i am facing:
    i have a variable called $date in php.This variable is assigned a valued from a dropdown box every time the user chose a different date. for example the drop down box return a string in that order "2007-10-10" I then assigned that string to $date.

    Now, what iam trying to do is using the following statement to return events associated with that date. in the sql statement below:
    [code=php]
    $result=mysql_q uery("select * from event_list where date='$date' ");
    [/code]
    and that does not work! Any help would be greatly appreciated.

    Thank you
  • ak1dnar
    Recognized Expert Top Contributor
    • Jan 2007
    • 1584

    #2
    Try this Please

    [CODE=php] $result=mysql_q uery("select * from event_list where date='{$date}' ");[/CODE]

    Comment

    • pbmods
      Recognized Expert Expert
      • Apr 2007
      • 5821

      #3
      Heya, Jean.

      Please use CODE tags when posting source code. See the REPLY GUIDELINES on the right side of the page next time you post.

      Comment

      • mwasif
        Recognized Expert Contributor
        • Jul 2006
        • 802

        #4
        There is no issue with your posted code.
        and that does not work!
        What do you mean?

        Comment

        • jjeanj1
          New Member
          • May 2007
          • 18

          #5
          Originally posted by mwasif
          There is no issue with your posted code.

          What do you mean?
          Hey guys thnx for all your input. The code actually does work. I am not sure why it was not wroking! vey weird.

          Comment

          • pbmods
            Recognized Expert Expert
            • Apr 2007
            • 5821

            #6
            Heya, Jean.

            Don't you just love it when that happens? Now if only it never happened in reverse (code breaks even though you touched *NOTHING*)...

            Good luck with your project, and if you ever need anything, post back anytime :)

            Comment

            Working...