Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    Senior Coder timgolding's Avatar
    Join Date
    Aug 2006
    Location
    Southampton
    Posts
    1,519
    Thanks
    114
    Thanked 110 Times in 109 Posts

    real escape string

    How can i add a escape string to this php mysql query

    PHP Code:
    mysql_query('insert into times (code, date, time, duration) values ("'.$course_code.'","'.$date_inSQL.'","'.$time_inSQL.'","'.$duration.'" )'); 
    You can not say you know how to do something, until you can teach it to someone else.

  • #2
    UE Antagonizer Fumigator's Avatar
    Join Date
    Dec 2005
    Location
    Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
    Posts
    7,691
    Thanks
    42
    Thanked 637 Times in 625 Posts
    Wrap each variable with mysql_real_escape_string()

  • #3
    Senior Coder timgolding's Avatar
    Join Date
    Aug 2006
    Location
    Southampton
    Posts
    1,519
    Thanks
    114
    Thanked 110 Times in 109 Posts
    Any chance of an example?
    Do you mean like this?

    PHP Code:
    mysql_query('insert into times (code, date, time, duration) values ("'.mysql_real_escape_string($course_code).'","'.mysql_real_escape_string($date_inSQL).'","'.mysql_real_escape_string($time_inSQL).'","'.mysql_real_escape_string($duration).'" )'); 
    Last edited by timgolding; 07-09-2007 at 10:54 AM.
    You can not say you know how to do something, until you can teach it to someone else.

  • #4
    Senior Coder
    Join Date
    Mar 2003
    Location
    Atlanta
    Posts
    1,037
    Thanks
    14
    Thanked 30 Times in 28 Posts
    PHP Code:
    mysql_query('insert into times (code, date, time, duration) values ("'.mysql_real_escape_string($course_code).'","'.mysql_real_escape_string($date_inSQL).'","'.mysql_real_escape_string($time_inSQL).'","'.mysql_real_escape_string($duration).'" )'); 
    Most of my questions/posts are fairly straightforward and simple. I post long verbose messages in an attempt to be thorough.

  • #5
    Senior Coder timgolding's Avatar
    Join Date
    Aug 2006
    Location
    Southampton
    Posts
    1,519
    Thanks
    114
    Thanked 110 Times in 109 Posts
    hehe thats funny
    You can not say you know how to do something, until you can teach it to someone else.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •