How to display table data one record at a time

I can easily display all the table data at one time. I would like to display one record at a time and use a button to advance to the next record to be displayed. Code follows for displaying all records:

<?php
	include_once '//WDP/DFS/30/1/0/8/3067916801/user/sites/4232274.site/www/includes/annual_show_connection.php';

$db = mysql_select_db("annual_show",$conn);
$query = "SELECT * FROM entries";
$result = mysql_query($query) or die(mysql_error());

echo "<table border = '1px'>";

while ($row = mysql_fetch_array($result))

{

	$ENTRY_ID = $row[0];
	$Class_Number = $row[1];
	$Exhibitor_Number = $row[2];
	$Exhibit_Number = $row[3];
	$Genus = $row[4];
	$Plant_Name_L1 = $row[5];
	$Plant_Name_L2 = $row[6];
	$Plant_Name_L3 = $row[7];

	echo "<tr>";
	
	echo "<td>{$ENTRY_ID}</td>";
	echo "<td>{$Class_Number}</td>";
	echo "<td>{$Exhibitor_Number}</td>";
	echo "<td>{$Exhibit_Number}</td>";
	echo "<td>{$Genus}</td>";
	echo "<td>{$Plant_Name_L1}</td>";
	echo "<td>{$Plant_Name_L2}</td>";
	echo "<td>{$Plant_Name_L3}</td>";

	echo "</tr>";
}
	echo "</table>";

?>

Hello, it will be easier for someone to offer advice if you surround php with code:

[code]<?php //enter php code ?>[/code]

like so:

<?php
include_once '//WDP/DFS/30/1/0/8/3067916801/user/sites/4232274.site/www/includes/annual_show_connection.php';

$db = mysql_select_db("annual_show",$conn);
$query = "SELECT * FROM entries";
$result = mysql_query($query) or die(mysql_error());
echo "";

while ($row = mysql_fetch_array($result)) {
$ENTRY_ID = $row[0]; $Class_Number = $row[1]; $Exhibitor_Number = $row[2]; $Exhibit_Number = $row[3]; $Genus = $row[4]; $Plant_Name_L1 = $row[5]; $Plant_Name_L2 = $row[6]; $Plant_Name_L3 = $row[7];
echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo "";
}
echo "{$ENTRY_ID} {$Class_Number} {$Exhibitor_Number} {$Exhibit_Number} {$Genus} {$Plant_Name_L1} {$Plant_Name_L2} {$Plant_Name_L3}";
?>

that is alot of empty output:

echo "";

then use a proper WHERE clause on some incrementing column. At least you should make a button at all.

Sponsor our Newsletter | Privacy Policy | Terms of Service