SitePoint Sponsor

User Tag List

Results 1 to 1 of 1
  1. #1
    SitePoint Member
    Join Date
    Jun 2005
    Kennett Square, PA USA
    0 Post(s)
    0 Thread(s)

    mysql encode decode question

    I am using mysql encode and decode and occassionally get a query error when the end user attempts to insert a record. I cannot replicate the error. Here are some specifics:

    This is part of the sql INSERT string, built with a PHP function:

    $sql ="INSERT INTO myTable ( amount,ccnum) VALUES
    ENCODE($amount,'".KEY."' ),
    ENCODE('$cardNumber','".KEY."' )

    - KEY is a constant defined elsewhere

    Should the $amount value also be quoted?

    The fields in the database are VARBINARY and their length is twice the lenth of the corresponding form fields

    Does anyone see a problem with this approach or a reason why I would get an occassional query error? (I don't have the error message but could probably get it but that would be time consuming at this point)
    Last edited by JackAlbright; Jan 5, 2010 at 12:42. Reason: fine tuning the message


Posting Permissions

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