php records navigation

0 votes

Code:

<?php 
$host='localhost'; 
$user='root'; 
$password='root'; 
$database='database'; 

$startindex=@$_REQUEST['seek']; 

$db=mysql_connect($host, $user, $password) 
or die ("Impossibile connettersi al server $host"); 

mysql_select_db($database, $db) 
or die ("Impossibile connettersi al database $database");



$query="SELECT * FROM ordini_master"; 
$dbResult=mysql_query($query, $db); 
$AffectedRows=mysql_affected_rows($db); 

mysql_data_seek($dbResult, $startindex); 

$row=mysql_fetch_row($dbResult); 

foreach($row as $k=>$v) 
{ 
    $myfield=mysql_fetch_field($dbResult, $k); 
    print($myfield->name . " : $v <br/>"); 
} 

mysql_free_result($dbResult); 
mysql_close($db); 

print("<br/>Seleziona il record<br/>"); 

for($index=0; $index<$AffectedRows; $index++) 
{ 
    print("<a href=\"{$_SERVER['PHP_SELF']}?seek=$index\" >" . 
    ($index+1) . "</a> "); 
} 
?> 

This code enables switching between a query's records, creating a page for every record in the database and displaying one record at a time. How can I change that code to page through records every ten? I want to display 10 records at a time and then make a page for the following.

Aug 8, 2022 in PHP by Kithuzzz
• 38,000 points
490 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.

Related Questions In PHP

0 votes
1 answer

What are the vulnerability related to PHP Form?

Hii, The $_SERVER["PHP_SELF"] variable can be used by ...READ MORE

answered Feb 13, 2020 in PHP by Niroj
• 82,840 points
3,212 views
0 votes
1 answer

How can we avoid my php form from hacking?

Hii @kartik, If you want to know php ...READ MORE

answered Feb 13, 2020 in PHP by Niroj
• 82,840 points
2,606 views
0 votes
1 answer

How to Validate Form Data With PHP?

Hey @kartik, The first thing we will do ...READ MORE

answered Feb 13, 2020 in PHP by Niroj
• 82,840 points
3,353 views
0 votes
1 answer

What is a Cookie? How to create Cookies With PHP?

A cookie is often used to identify ...READ MORE

answered Feb 13, 2020 in PHP by Niroj
• 82,840 points
3,805 views
0 votes
1 answer

How to validate E-mail and URL of Php form?

hey, The code below shows a simple way ...READ MORE

answered Feb 13, 2020 in PHP by manish
2,378 views
0 votes
1 answer

What is Php json?

Hii @kartik, JSON stands for JavaScript Object Notation, ...READ MORE

answered Feb 14, 2020 in PHP by Niroj
• 82,840 points
612 views
0 votes
0 answers

Creating a search form in PHP [duplicate]

I am working on a function where ...READ MORE

Jun 9, 2022 in PHP by Kichu
• 19,040 points
420 views
0 votes
0 answers

How to delete image form folder and database

With the code below, I'm displaying data ...READ MORE

Jul 26, 2022 in PHP by Kithuzzz
• 38,000 points
1,355 views
0 votes
0 answers

How to fetch specific data from MySQL database to my PHP table?

I want to get data from the ...READ MORE

Jul 28, 2022 in PHP by Kithuzzz
• 38,000 points
3,314 views
0 votes
0 answers

How can I prevent SQL injection in PHP?

The programme  becomes vulnerable to SQL injection ...READ MORE

Jul 28, 2022 in PHP by Kithuzzz
• 38,000 points
451 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP