ryntak4536 Posted March 8, 2015 Share Posted March 8, 2015 Hello all, Newbie here...This WHERE clause in the query of this function is not working, but I cannot figure out why: function find_author_list($author_intial){ global $connection; //Perform author query $query = "SELECT * "; $query .= "FROM authors "; $query .= "WHERE Last_Name LIKE \"{$author_initial}%\" "; $query .= "ORDER BY Last_Name ASC"; $author_set = mysqli_query($connection, $query); //test if there was a query error confirm_query($author_set); return $author_set; } I'm calling it with $author_set = find_author_list($current_initial); And instead of limiting it to the initial passed to it, it's returning ALL of the authors in my database. I've included an echo at the top of my page to show me what $current_initial is, and it's clearly a single letter. Any help is appreciated! Quote Link to comment https://forums.phpfreaks.com/topic/295177-where-clause-in-query-not-working/ Share on other sites More sharing options...
Solution ryntak4536 Posted March 8, 2015 Author Solution Share Posted March 8, 2015 NEVERMIND! I just found my error! Quote Link to comment https://forums.phpfreaks.com/topic/295177-where-clause-in-query-not-working/#findComment-1507898 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.