xfezz Posted November 5, 2006 Share Posted November 5, 2006 Currently I have a pagination script that shows the content of my database. I want to be able to do a simple search in my database and display the results of the search with my pagination script. I dont want to redirect to another page for the search. I want to display the results of the search in place of displaying all the results in x pages. I was thinking about doing something a long the lines of the following[code]$search = $_POST['txtSearch'];if ($search == null) { // search field is null no search was performed, display all records $sql = "SELECT * FROM articles ORDER BY id DESC LIMIT $from, $max_results"; $getlist = mysql_query($sql) or die(mysql_error());}else{ // a search was performed, display results of the search $sql = "SELECT * FROM articles WHERE message LIKE '%search%' ORDER BY id DESC LIMIT $from, $max_results"; $getlist = mysql_query($sql) or die(mysql_error());}[/code]im sure my syntax is a bit off on the search query but am i going in the right direction with this? Link to comment https://forums.phpfreaks.com/topic/26196-how-would-i-go-about-adding-a-simple-search-to-my-pagination/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.