dodgeitorelse3 Posted July 10, 2013 Share Posted July 10, 2013 I have a query such as : $map = mysql_real_escape_string ($_GET['map']); //echo $map; $result = mysql_query("select content, size, released, creator, modder, type from `maps` WHERE `trname` LIKE '$map%' ORDER BY trname ASC") or die('Error, query failed'); this works fine except for one map which is called Abbusata_Bridge_Coop. When $_GET['map'] is equal to Abbusata_Bridge_Coop I can echo $map and it displays as such but in the query it returns it cannot find it in database however when I change query to $result = mysql_query("select content, size, released, creator, modder, type from `maps` WHERE `trname` LIKE 'Abbusata_Bridge_Coop' ORDER BY trname ASC") it works. Can anyone shed some light on this issue for me? I should say that I use $map% in query because I need to show all maps that start with that name (some have added text at end of them). Quote Link to comment https://forums.phpfreaks.com/topic/280035-problem-with-where-condition/ Share on other sites More sharing options...
mac_gyver Posted July 10, 2013 Share Posted July 10, 2013 (edited) when you echo $map, what does the 'view source' of that look like in your browser? and what is your code that is building the specific link with that value in it? Edited July 10, 2013 by mac_gyver Quote Link to comment https://forums.phpfreaks.com/topic/280035-problem-with-where-condition/#findComment-1440173 Share on other sites More sharing options...
dodgeitorelse3 Posted July 10, 2013 Author Share Posted July 10, 2013 ahhh, looking at the view source it is showing <div style='float:left;' class='showchevy_1'> <iframe id='mapdl' scrolling='no' marginwidth='0' marginheight='0' frameborder='0' vspace='0' hspace='0' style='overflow:visible; width:100%;' src='/maps/php/map_dload2.php?map=Abbusata_Bridge_Coop'> </iframe> </div> It must be getting the from the game server itself during query. I assume I have to make a change in my database for the collation for this column. Any suggestions? I tried setting the trname column for this map to Abbusata_Bridge_Coop but still doesn't find it. the source code for the echo is <body bgcolor="darkslategrey"><br> Abbusata_Bridge_Coop<font color='lightgreen' size=2><b><i><font color='white'>Abbusata_Bridge_Coop</font></i></b> was not found.</font></body> Quote Link to comment https://forums.phpfreaks.com/topic/280035-problem-with-where-condition/#findComment-1440179 Share on other sites More sharing options...
Solution dodgeitorelse3 Posted July 10, 2013 Author Solution Share Posted July 10, 2013 Solved using preg_replace('/[^a-zA-Z0-9_ %\[\]\.\(\)%&-]/s', '', $map) Thanks for your help mac_gyver, just needed to be pointed in right direction. Quote Link to comment https://forums.phpfreaks.com/topic/280035-problem-with-where-condition/#findComment-1440231 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.