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! Link to comment https://forums.phpfreaks.com/topic/295177-where-clause-in-query-not-working/ Share on other sites More sharing options...
ryntak4536 Posted March 8, 2015 Author Share Posted March 8, 2015 NEVERMIND! I just found my error! 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
Archived
This topic is now archived and is closed to further replies.