Hi,

Can anyone kindly help me to modify the following script to diplay the result in several pages if the resuts are greater than 10.

<?php 
$action = $_SERVER['SCRIPT_NAME'];
?>
<?php 
//if(!$_POST['search']=='result')
//{echo "<p style=' font-family: arial; color: blue; font-size: 14px;'>You are not authorized!</p>"; return false;}
//$choice=$_POST['choice'];
$name=$_POST['name'];
$link=mysql_connect("localhost", "root", "") or die("<p class='texxt'>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="<p class='error'>No Results Found</p>";}
elseif ($num_rows > 0){$search_result="<p class='error'>".$num_rows. " Articles Found</p>";}
?>
<body topMargin="0" onLoad="dynAnimation()" vlink="#0000FF" alink="#0000FF" bgcolor="#fffff0" language="Javascript1.2">
<div align="left">
<table border="0" cellPadding="0" cellSpacing="0" 
height="112" width="100%">
  <tbody>
  <tr>
    <td height="112" width="994"><img border="0" src="img/x.gif" width="990" height="102"></td>
  </tr></tbody></table></div>
<div align="left">
<table border="0" cellPadding="0" cellSpacing="0" width="100%">
  <tbody>
  <tr>
    <td valign="top">
      <div align="left">
        <table border="0" cellpadding="0" cellspacing="0" width="979">
          <tr>
            <td width="312">
            </td>
            <td align="center" width="355">
              <a onMouseOver="document['fpAnimswapimgFP2'].imgRolln=document['fpAnimswapimgFP2'].src;document['fpAnimswapimgFP2'].src=document['fpAnimswapimgFP2'].lowsrc;" onMouseOut="document['fpAnimswapimgFP2'].src=document['fpAnimswapimgFP2'].imgRolln" href="javascript:void(0)">
              <img border="0" src="img/hsl1.gif" id="fpAnimswapimgFP2" name="fpAnimswapimgFP2" dynamicanimation="fpAnimswapimgFP2" lowsrc="img/HSL2.gif" width="354" height="25"></a></td>
<!-- Search Google -->
<form method=GET action=http://www.google.com/custom>
<td width="312" align="right">&nbsp;&nbsp;
<input type=hidden name=cof VALUE="AH:center;LH:36;L:http://www.nwafh.med.sa/eng/HTML/libweb/img/HSL-NWAFH.gif;LW:432;AWFID:8099ac48bde120fe;">
</td></form>
          </tr>
        </table>
      </div>
    </td></tr></tbody></table></div>
<div align="left">
<table background="img/bg2.gif" border="0" cellPadding="0" cellSpacing="0" 
width="989">
  <tbody>
  <tr>
    <td width="845">
      <p align="left"><a href="Index.htm"><img border="0" src="img/Home.gif" width="161" height="31"></a><img border="0" src="img/SPACE.gif" width="10" height="10"><a href="about.htm"><img border="0" 
      src="img/ABOUT.gif" width="116" height="31"></a><img border="0" 
      src="img/SPACE.gif" width="10" height="10"><a href="services.htm"><img border="0" 
      src="img/SERVICES.gif" width="116" height="31"></a><img border="0" 
      src="img/SPACE.gif" width="10" height="10"><a href="ejournals.htm" target="_self"><img border="0" src="img/JOURNAL.gif" width="116" height="31"></a><img border="0" 
      src="img/SPACE.gif" width="10" height="10"><a href="eb.htm"><img border="0" 
      src="img/BOOKS.gif" width="116" height="31"></a><img border="0" 
      src="img/SPACE.gif" width="10" height="10"><a href="databases.htm"><img border="0" 
      src="img/DATABASE.gif" width="116" height="31"></a></p></td>
    <td width="140">
      <p align=center>&nbsp;</p></td></tr></tbody></table></div>
<div align=center>
<center>
<table border="0" cellPadding="2" cellSpacing="3" width="108%">
  <tbody>
  <tr>
    <td width="145" rowspan="2" valign="top" bgcolor="#339966">
      <p align="center"><b><font size="4">NWAFH<br>
  </font><font size="2">Health Sciences Library </font></b></p>
  <table id="table2" width="103%" border="0">
   <tr>
    <td align="left"><font color="#ffffff" size="2">About 
    SaudiMedLit</font></td>
   </tr>
   <tr>
    <td align="left"><font color="#ffffff" size="2">Journal List</font></td>
   </tr>
   <tr>
    <td>
    <p align="left"><font color="#ffffff" size="2">Issues Indexed To 
    Date</font></td>
   </tr>
   <tr>
    <td><font size="2">&nbsp;</font></td>
   </tr>
   <tr>
    <td>
    <p align="left" class="style20"><a href="tips1.htm" class="style21">Search Tips</a></td>
   </tr>
  </table>
  <p></td>
    <td width="900">
      
   <form name="search_form" action="display3.php" method="post">      
              <div align="center">
                <input type="hidden" name="search" value="result" />
         <b>&nbsp;<font size="4" color="#0000ff"><br>
</font><span class="style22"><font color="#0000ff">SaudiMedLit</font></span></b>
               <font size="2">   
               <font color="#008000">is a service of the Health Sciences 
      Library, North West Armed Forces Hospital, Tabuk, KSA</font>&nbsp;</font>
     </div>
              <p align="center">
    <b>&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; SEARCH&nbsp;&nbsp;&nbsp;&nbsp; </b>
    <SELECT name="choice" size="1">
       <!-- <option value="books">Books</option> -->
      <option value="smj">Saudi Medical Journals</option>
      <!-- <option value="staffpub">Staff Publications</option> -->
           
           </SELECT> 
     <b>FOR</b> 
     <input name="name" />
     <input name="B1" type="button" value="Go!" onClick="search_submit()" />&nbsp;&nbsp;&nbsp;&nbsp;
              </p>
   </form>
   
   
   </td>
    <td width="1">&nbsp;</td>
  </tr>
  <tr>
    <td colspan="2" width="870">
            <?php 


         echo '<table border="0" cellspacing="10">';
       echo '<tr>';
         echo '<td colspan="2" class="staffpub_title" align= "center"><font color="blue" size="4"> Search Results </font></td>';
       echo '</tr>';
     echo '<tr><td align="center" colspan="2"><font color="red" face="Georgia, Times New Roman, Times, serif">'.$search_result.'</font></td></tr>';
     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 '<tr>';
         echo '<td width="200" align="right" valign="top"><b>Title of the Article: </b></td>';
         echo '<td align="left" valign="top">'.$TI.'</td>';
       echo '</tr>';
       echo '<tr>';
         echo '<td align="right"  valign="top"><b>Author(s)          : </b></td>';
         echo '<td align="left"  valign="top">'.$AU.'</td>';
       echo '</tr>';

       echo '<tr>';
         echo '<td align="right"  valign="top"><b>Source              :</b></td>';
         echo '<td align="left"  valign="top">'.$SO.'</td>';
       echo '</tr>';       

       echo '<tr>';
         echo '<td align="right"  valign="top"><b>Address of the Author: </b></td>';
         echo '<td align="left"  valign="top">'.$AD.'<hr></td>';


             echo '</tr>';          

              echo '<tr>';
         echo '<td colspan="2" class="staffpub_left">&nbsp;</td>';
       echo '</tr>';}

    echo '</table>';

  ?>                                                           
  <p>&nbsp;</p>
  <p><br />
    </p>
  <p></td>
    </tr></tbody></table>
</center></div>
              <div align=left>
              <table bgColor=#000000 border="0" cellPadding="2" cellSpacing="3" width="1010" height="41">
  <tbody>

Recommended Answers

All 4 Replies

How I do it on my blog is I loop through the number of rows until it hits a magic number (10) and then doesn't parse the results any further. To get the next set of results, a GET request is made passing in the starting place of the next set.

How I do it on my blog is I loop through the number of rows until it hits a magic number (10) and then doesn't parse the results any further. To get the next set of results, a GET request is made passing in the starting place of the next set.

can you please edit the above code like you did in your blog?

hi ,

just make change in ur mysql query and apply LIMIT 0,20 ; in ur mysql query and when u click on pagging means display number apply next limit 20,20 ; i will work but for that u should get firstall of all all record and then decompose it into ur desire limit....u can down load pagging class and impliment to ur script it's easy way to have it ...and it's better to work on class strucutre it's advance...

just search it on google

thank you manish. I will try it.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.