Jump to content

Recommended Posts

Hi,

 

Ive created a recordset and the records are displayed logically down the page.

 

Thing is I only want to display 10 records at a time to stop the page going on for ages as its filed with hundreds of records. In addition a need a: First, Last, Next & Previous hyperlinks that will enable the user to navigate these records.

 

Heres my code for my page so far:

 

 

  <style type="text/css">

<!--

body,td,th {

font-family: Arial, Helvetica, sans-serif;

font-size: 12px;

}

-->

  </style>

  </head>

 

    <body>

 

    <span class="border_bottom">

    <?php

 

//check if the user entered data in the form

if (isset($_POST['find'])) {

//data has been entered so lets search the mofo

echo "<h2>Results</h2><p>";

// sanitise the data

$find = strtoupper($_POST['find']);

$find = strip_tags($_POST['find']);

$find = trim ($_POST['find']);

//connect to the db

mysql_connect("localhost", "root", "") or die(mysql_error());

mysql_select_db("laptop_loan_database") or die(mysql_error());

//Now we search for our search term, in the field the user specified

$query = "SELECT * FROM teachersname WHERE " . $_POST['field'] . " LIKE '%$find%'"  ;

$data = mysql_query($query);

 

 

//And we display the results

while($result = mysql_fetch_array( $data ))

{

?>

    </span>

 

 

  <?php

 

echo"<table width=\"200\" border=\"0\" class=\"border_bottom\"> \n";

echo "<tr> \n";

 

  echo "<td> </td> \n";

  echo "</td> \n";

  echo "</tr> \n";

  echo "<tr> \n";

    echo "<td>"; echo "<strong>Client Name</strong>"; echo "</td>";

    echo "<td width=\"75\" style=\"text-align: left;\">"; ?>

  <em><a href="search_client_details.php?recordID=<?php echo $result['Client']; ?>"><?php echo $result['Client']; ?> </a></em> <?php echo " </td> \n";

  echo "</tr> \n";

  echo "<tr> \n";

 

  echo "<td>"; echo "<strong>Department Code</strong>"; echo "</td>";

      echo "<td>"; echo "<em>"; echo $result['DepartmentCode']; echo "</em>"; echo "</td>";

   

  echo "</tr> \n";

 

  echo "<tr> \n";

  echo "<td> </td> \n";

  echo "</td> \n";

  echo "</tr> \n";

  echo  "<br>";

 

echo "</table> \n";

 

echo "<br>";

 

echo"<table width=\"200\" border=\"0\" class=\"border_bottom\"> \n";

echo "<tr>";

echo "<td>";

 

 

 

echo "</td>";

echo "</tr>";

 

echo "</table>";

 

 

 

 

 

 

}

 

//This counts the number or results - and if there wasn't any it gives them a little message explaining that

$anymatches=mysql_num_rows($data);

if ($anymatches == 0)

{

echo "Sorry, but we can not find an entry to match your query<br><br>";

}

}

 

?>

 

 

  <?php

mysql_free_result($user_conditional);

?>

 

 

 

 

The trouble is im not sure how to create the recordset navigation.

 

If someone could either lend me some help or point me in right direction to get some help id be most greatful.

 

Thank you :)

 

 

 

[attachment deleted by admin]

Link to comment
https://forums.phpfreaks.com/topic/52005-recordset-navigation/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.