Tenaciousmug Posted January 15, 2012 Share Posted January 15, 2012 $sql = "SELECT softwareID,softwareName,softwareType,softwareDesc,softwarePath,ITOnly FROM software WHERE softwareName LIKE '%($searchSoftware)%' ORBER BY softwareName"; $result = mysqli_query($cxn,$sql) or die(mysqli_error()); There is something wrong with my LIKE statement because it's not pulling it since I'm either formatting it wrong or something. Can anyone catch it? Quote Link to comment https://forums.phpfreaks.com/topic/255066-sql-like-problem/ Share on other sites More sharing options...
litebearer Posted January 15, 2012 Share Posted January 15, 2012 a wild guess, but try removing the parens surrounding the LIKE Quote Link to comment https://forums.phpfreaks.com/topic/255066-sql-like-problem/#findComment-1307868 Share on other sites More sharing options...
Psycho Posted January 15, 2012 Share Posted January 15, 2012 a wild guess, but try removing the parens surrounding the LIKE No, that's not it. You need to use curly braces {} around the variable $searchSoftware, NOT parens () $sql = "SELECT softwareID, softwareName, softwareType, softwareDesc, softwarePath, ITOnly FROM software WHERE softwareName LIKE '%{$searchSoftware}%' ORBER BY softwareName"; $result = mysqli_query($cxn, $sql) or die(mysqli_error()); Quote Link to comment https://forums.phpfreaks.com/topic/255066-sql-like-problem/#findComment-1307875 Share on other sites More sharing options...
Tenaciousmug Posted January 15, 2012 Author Share Posted January 15, 2012 Ah it's still not working, but I did fix that. [15-Jan-2012 12:13:03] PHP Warning: mysqli_error() expects exactly 1 parameter, 0 given in /home1/elvonica/public_html/intellectproductions/james/search_software.php on line 13 Which is where the result variable is. So it's not returning anything, but when I put that in the sql statement in the phpmyadmin, it gives me the result I want. Of course, I change the LIKE '%{$searchSoftware}%' to LIKE '%hatch%'. EDIT Nvm. I'm dumb. xD I spelled ORDER BY wrong. Thank you!!!! Quote Link to comment https://forums.phpfreaks.com/topic/255066-sql-like-problem/#findComment-1307882 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.