Re: SearchEngine limitation

From: Date: Tue, 12 Dec 2000 15:18:59 +0000
Subject: Re: SearchEngine limitation
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-29892@lists.php.net to get a copy of this message
Hi Dhaval! This is some code that is working ok for me. Hope it help you... <? /* number of records to show per page... you can modify this number */ define("MAX_RECS", 20) ; /* first record: first time = 0, next times is passed to this script as this_script.php3?first_rec=number_to_start */ if (!isset($first_rec)) { $first_rec = 0; } // # of records to return $query = "SELECT * FROM sometable'"; $result = mysql_query($query) ; // total number of records $max_pages = mysql_num_rows( $result ) ; // now execute the query to show MAX_RECS per page $query = "SELECT * FROM sometable LIMIT $first_rec, " . MAX_RECS ; $result = mysql_query($query); // now make the 1 2 3 4 5 6 pages if ($max_pages > MAX_RECS) { print "Page: | "; for ($i = 0; $i <= ( $max_pages / MAX_RECS ); ++$i) { $j = $i+1; print "<a href='this_script.php3?first_rec=" . MAX_RECS * $i . "'>" . $j . "</a> | "; } } // end ?> Good luck! Marcelo Gulin Dhaval Desai escribió: > Hello Guys! > > I am trying to make a simple search engine..using php > and mysql. > I have allready done this successfully. The problem is > I want to organise the search results that I get with > the search. > For a search that generates 600 results What I want to > do is an altavista kind of display: > Like: > > 1 2 3 4 5 6 next>> > > Meaning the siz links above when clicked gets the > result. What I am currently getting is just a next > buttin. > can anybody help me in getting the logic behind the > altavista kind of search. > I have seen that work with php aswell on > http://www.flashkit.com > > Waiting for your reply. > > Thanx a lot! > Dhaval Desai > > __________________________________________________ > Do You Yahoo!? > Yahoo! Shopping - Thousands of Stores. Millions of Products. > http://shopping.yahoo.com/ > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.general (#29892) next »