Reply
Search engine
Replies: 1   Views: 1008  Subscribers: 2

Posted by ferman · 05-01-2013 - 01:42

hi/
i have made a search engine and connected to my PHPMySQL database. i have manage to get data from the database fields on the local server. but what i have problem with is how to filter the the amount of information. here is the two code files i made for this purposes:

**********this is the index.php file***********
­
<html>
<form action= 'search.php' method='GET'>
<font face='sans-serif' size='5'>
<center>
Welcome to Ferman's Search Engine. <br>
<input type='text' size='50' name='search'> <input type='submit' name='submit' value='Search'>
</center>
</font>
</form>
</html>­
*********This is the counter file for the index file called search.php *********** ­
<?php

//here we connect to database
mysql_connect("localhost","root","fbr110404") or die (mysql_error());
echo "Connected to MySQL<br /><hr />";

mysql_select_db("searchengine") or die (mysql_error());
echo "Connected to Database<br /><hr />";

$query = "SELECT * FROM hooks";
$result = mysql_query($query) or die (mysql_error());
while ($row = mysql_fetch_array($result)) {
echo $row['Hook_ID'] . " - " . $row['Hook_Info'];
echo "<br />";

}
?>­
Best Regards Ferman­

Posted by reece · 07-01-2013 - 15:56

You need to implement some kind of pagination here.

Usually, you take take a string query from the url for this for the page you want to filter to. Use that page number with an offset and limit to get a slice of the query for the given page.

I found a guide to achieve this relatively quickly, give this a try and tell me if this is what you are after or not or if you get stuck.

­Pagination Tutorial­

Also i edited your post to wrap code in the proper CODE tags, please use them in future so that your code is legible. BBTags are in all uppercase and in square brackets.

­
[CODE][/CODE]