dcsimg
A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: encoding strings for PHP/SQL

  1. #1
    Junior Member
    Join Date
    May 2002
    Posts
    4

    Red face

    could someone please tell me which characters need to be encoded to pass a string through PHP and SQL, how to encode the string, and how to decode it later? Thanks a ton!

  2. #2
    Registered User
    Join Date
    Feb 2001
    Posts
    184
    Which version of PHP are you using?

  3. #3
    well, i'm not totally sure i understand your question, but it's quite easy. if you're looking to pass variables to php in a url, just do it like so:

    http://www.yourdomain.com/script.php...e1&var2=value2

    so essentially you just tack on a ? after the php file name, then variable name = value. to separate variables, simply put a & between them.

    if you're using the most common version of php (4.1 i think), you don't have to do anything to decode them. if you're using php >4.2, use HTTP_GET_VARS[variable_name]. check out devshed.com's excellent php/mysql tutorial.

  4. #4
    Registered User
    Join Date
    Feb 2001
    Posts
    13,044
    Hi,

    as for the original question: it is better to use
    "http://www.yourserver.com/script.php?var1="+escape(value1)

    Php will automatically translate these things back

    Musicman

  5. #5
    Junior Member
    Join Date
    May 2002
    Posts
    4

    thanks

    thanks. i was looking for the 'escape' command. i presume any strings sent to PHP4 and mySQL that are formatted with 'escape' will work nicely and won't blow up the program. i appreciate the help, guys.

Posting Permissions

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




Click Here to Expand Forum to Full Width

HTML5 Development Center