Next ---- Previous Button/Function????

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi all,
I need some help with navigation in an array.
The plan is to display a row and by using a 'Next" or 'Previous' button to
display, on the same form, the next or previous row from that array.
The array is populated correctly and when the script runs it displays all
twelve elements, followed by the 'Next' button.
How can it be fixed that the 'Next' button triggers the display of the next
row in an array?


Here is the code, please help me out.


+++++++++++++++++++++++++++++++++++++++++++++++++

<?php
require '../common.inc';
$tableName="tblcustomerproductid";
function DisplayErrMsg( $message )
{
printf("<blockquote><blockquote><blockquote><h3><font color=\"#cc0000\">
        %s</font></h3></blockquote></blockquote></blockquote>\n", $message);
}

//echo ($userName);
//echo ($userPassword);
//echo ($foundKey);
if (!($link = mysql_connect ($DB_SERVER,$DB_LOGIN, $DB_PASSWORD))) {
   DisplayErrMsg(sprintf("internal error %s %d:%s\n",$DB_SERVER, $DB,
      mysql_errno(), mysql_error()));
   return 0 ;
}
$sqlStmt="SELECT * FROM $tableName WHERE CustomerId='$foundKey'";
mysql_select_db($DB,$link);
if (!($result = mysql_query($sqlStmt, $link))):
   DisplayErrMsg(sprintf("Error in executing %s stmt", $sqlStmt));
   DisplayErrMsg(sprintf("error:%d %s", mysql_errno($link),
mysql_error($link)));
   exit();
endif;
$idx=0;
while ($row = mysql_fetch_object($result)){
  $rSet[$idx]=$row;
  ++$idx;
}
$rowCount=mysql_num_rows($result);
echo ("$rowCount <br>\n");

THE ARRAY IS POULATED CORRECTLY.
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Customer Product ID</title>
</head>
<body background="../images/folbkgnd.jpg">
<Form method =post>
<?php
$i=0;
do{
  echo ($rSet[$i]->CustomerProductId);
?>
  <input type="button" name="act" value="Next" onClick="<?php  $i=$i+1;?>">
<br>
<?php
}while($i < $rowCount);
exit();
?>
</form>

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++


Thanks,

Dick Davis
Skyline Data Systems
Professional IT Solutions.

dickdavis@skylinedatasystems.com

[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux