nickdrums Posted August 17, 2010 Share Posted August 17, 2010 I have written a simple PHP script which is matching bank payment references to those stored in a simple table to allocate payments. All is fine until the script tries to match the reference: FROST DD %0 NC It is the % sign which is confusing things. The exact query is as follows: SELECT t1.*, t2.* FROM ds_references AS t1, ds_tutors AS t2 WHERE t1.reference = 'FROST DD %0 NC' AND t1.tut_id = t2.tut_id This exact query executed through phpmyadmin does return the correct record, but using my PHP script returns no records. I have tried escaping the % character with a single quote, a backslash and another % character, to no avail. I've also tried passing the reference through mysql_real_escape_string but still no good. The query works fine for all other references. Can anyone help me see what I'm missing? Quote Link to comment https://forums.phpfreaks.com/topic/210933-match-character-in-where-clause/ Share on other sites More sharing options...
fenway Posted August 17, 2010 Share Posted August 17, 2010 If you're in double-quotes, maybe you're getting interpolation of some sort. Quote Link to comment https://forums.phpfreaks.com/topic/210933-match-character-in-where-clause/#findComment-1100350 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.