954,184 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

pagination of mysql query results

Hi,

Um new to php... kindly help me on the following...

<?php
$action = $_SERVER['SCRIPT_NAME'];
?>
<?php
//if(!$_POST['search']=='result')
//{echo "You are not authorized!


"; return false;}
//$choice=$_POST['choice'];
$name=$_POST['name'];
$link=mysql_connect("localhost", "root", "") or die("Can't connect to server: ".mysql_error());
mysql_select_db("test",$link);
$query="SELECT * FROM saudi_journal WHERE match (FAU, TI, AU, SO, PT, DP, MESH, KW, TA, AD, ISSN, NOTE) against ('$name' in boolean mode) ORDER BY DP DESC";
$result=mysql_query($query,$link) or die("Cannot find Server: ".mysql_error());
$num_rows = mysql_num_rows($result);
if ($num_rows=="0"){$search_result="

No Results Found


";}
elseif ($num_rows > 0){$search_result="".$num_rows. " Articles Found


";}
?>

x.gif hsl1.gif    Home.gifSPACE.gifABOUT.gifSPACE.gifSERVICES.gifSPACE.gifJOURNAL.gifSPACE.gifBOOKS.gifSPACE.gifDATABASE.gif



 






NWAFH
Health Sciences Library



About
SaudiMedLit
Journal List

Issues Indexed To
Date



 

Search Tips






 
SaudiMedLit

is a service of the Health Sciences
Library, North West Armed Forces Hospital, Tabuk, KSA 


       SEARCH    
Saudi Medical JournalsFOR
    







 

<?php


echo '';
echo '';
echo ' Search Results ';
echo '';
echo ''.$search_result.'';
while ($rs = mysql_fetch_array($result)){
$TI=$rs['TI'];
$AU=$rs['AU'];
$FAU=$rs['FAU'];
$SO=$rs['SO'];
$DP=$rs['DP'];
$PT=$rs['PT'];
$MESH=$rs['MESH'];
$KW=$rs['KW'];
$TA=$rs['TA'];
$TF=$rs['TF'];
$EDTA=$rs['EDAT'];
$AD=$rs['AD'];
$ISSN=$rs['ISSN'];
$NOTE=$rs['NOTE'];
$EB=$rs['EB'];

echo '';
echo 'Title of the Article: ';
echo ''.$TI.'';
echo '';
echo '';
echo 'Author(s) : ';
echo ''.$AU.'';
echo '';

echo '';
echo 'Source :';
echo ''.$SO.'';
echo '';

echo '';
echo 'Address of the Author: ';
echo ''.$AD.'';


echo '';

echo '';
echo ' ';
echo '';}

echo '';

?>
 








I have made the above basic script to query the mysql database and display the result. right now all the results are displayed in one page. I want the results to be displayed in several pages if my search result is more than 10 . Can any one please help me to modify this script.

thank you in advance.

Rgd,
Shaz

ShazB2K
Newbie Poster
2 posts since Jun 2006
Reputation Points: 10
Solved Threads: 0
 

see http://www.php-mysql-tutorial.com/php-mysql-paging.php
so far the best tutorial I've seen about paging your results

zippee
Posting Whiz in Training
294 posts since Jan 2005
Reputation Points: 10
Solved Threads: 7
 

Please wrap code in [ code ] and [/ code ] tags.

Puckdropper
Posting Pro
500 posts since Jul 2004
Reputation Points: 23
Solved Threads: 23
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You