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)