NewBie's DB Questions..

From: Date: Mon, 09 Oct 2000 18:42:22 +0000
Subject: NewBie's DB Questions..
Groups: php.general 
Request: Send a blank email to php-general+get-19223@lists.php.net to get a copy of this message
Hey all, I have a search engine of sorts running right now but I would like to limit the search results to 10, 25 & 50 per page, while giving the user the choice to pick the number of results per page.. Now, the way it does it now is that it goes in a for loop and prints out all the result, as such:- for ($i = mysql_num_rows ($result) - 1; $i >=0; $i--) { if (!mysql_data_seek ($result, $i)) { printf ("Cannot seek to row %d\n", $i); continue; } if(!($row = mysql_fetch_object ($result))) continue; printf ("$a) %s %s, $row->f_name, $row->f_real_name"); $a = $a + 1; } Can anyone tell me how I would be able to limit the results around this code... Also, I would like it so that if there are NO results, the user is given a message saying that, your search "blah" had 0 results or some stupid message like that instead of giving me a no data in this document or something like that.. For this I guess I could use the counter $i, would that be correct? The other functionality I would like to incorporate is multiple queries into one.. i.e. You can search using Name, Country, Place or Thing and then you can search ALL.. Now the way I have it setup is that the HTML page sends the category to the PHP script for each one and each one of the them have a different MySQl query attached to it, how would I incorporate every query and print them out one after the other, saying for Name these searches were yielded, for Country these results were yielded etc. etc.. Or what I could also do is, create sub-categories such as Name, Country, Place etc. that point to a link that would give them an alphabetical listing of every entry in the DB in the Name table, Country table etc.. but for that I would have to go something like:- http://myurl.com/phpscript.php?field=Country or something such as that correct? How would I account for this in the script? Thanks a lot in advance....

« previous php.general (#19223) next »