wemustdesign Posted March 12, 2009 Share Posted March 12, 2009 I am doing a query but the wildcard does not work when I use a variable for a wildcard, not sure if its the syntax. Works like this: $sql = "SELECT * FROM cocktails WHERE name LIKE 'a%' ORDER BY name "; Doesnt work when I use a variable though: $sql = "SELECT * FROM cocktails WHERE name LIKE '$get_letter%' ORDER BY name "; Quote Link to comment https://forums.phpfreaks.com/topic/149116-solved-wildcard/ Share on other sites More sharing options...
premiso Posted March 12, 2009 Share Posted March 12, 2009 $sql = "SELECT * FROM cocktails WHERE name LIKE '{$get_letter}%' ORDER BY name "; Try that. Quote Link to comment https://forums.phpfreaks.com/topic/149116-solved-wildcard/#findComment-782972 Share on other sites More sharing options...
wemustdesign Posted March 12, 2009 Author Share Posted March 12, 2009 That sorted the problem thanks! Quote Link to comment https://forums.phpfreaks.com/topic/149116-solved-wildcard/#findComment-783062 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.