Batch update record with Pagination
Posted on
16th Feb 2014 07:03 pm by
admin
Hoping someone can help me with this issue I'm having, im trying to batch update records from a result set with pagination. The first page results (first 10 records) will update with the batch, but any other pages will not update.... the pagination coding is preventing the rest of the results to update when a date change is made.
Here's the code im using:
<div class="searchTitle">SCHEDULING</div>
<div class="tabber" id="mytab1">
<div class="tabbertab">
<h2>RECORDS</h2><form name="namestoupdate" method="post" action="updateschedule.php">
<div class="searchTitle">RECORDS<input type='submit' class="submitButton" value='SUBMIT' src="images/submit.png" /></div>
<table cellspacing="0" id="box-table-a">
<tr>
<th>TITLE</th>
<th>DATE</th>
</tr>
<?php
$i = 0;
while ($result_row = mysql_fetch_array($resultbypass)) {
if($i< $startbypass || $i>=$stopbypass) { $i++; continue; }
$i++ ; ?>
<tr>
<td><?php print "<input type='hidden' name='ID[$i]' value='{$result_row['ID']}' />" ?> <?php echo $result_row['Provider']; ?></td>
<td><?php echo $result_row['Title']; ?></td>
<td><?php print "<input type='text' size='8' name='Date[$i]' value='{$result_row['Date]}' maxlength='10' />";
?></td>
</tr>
<?php } ?>
</table>
<?php echo getPaginationString($pagebypass,$totalitemsbypass,$itemsPerPage,1,$targetpage,$pagestringbypass); ?>
</form>
</div>
Batch update script: (updateschedule.php)
<?php
session_start();
include("connect.php");
$size = count($_POST['ID']);
$i = 0;
while ($i <= $size) {
$Date= $_POST['Date'][$i];
$id = $_POST['ID'][$i];
$query = "UPDATE Table
SET Date= '$Date'
WHERE ID = '$id' LIMIT 1";
mysql_query($query) or die ("Error in query: $query");
++$i;
}
mysql_close();
?>
No comments posted yet
Your Answer:
Login to answer
248
50
Other forums
SAP FICO learning materials
Hi all,
I am new to this world of SAP FICO. I have taken training on SAP FICO, but was wonderin
limitations on array_unique()
Does any one know what/how imitations are applied to array_unique? I have an issue where no matter h
a function to check directory depth
I'm working on a php script to upload files in to a set directory.
the user can select to upload
Page doesn't expand for content
Hi. I've been testing a query I made. It's here http://lapr1.6te.net/inquerito.php
The page doesn
PECL uploadprogress for php5.2
Hey, I just installed PHP5 via .htaccess on my 1and1 Shared Hosting Account.
How would I exac
PHP and SMS
Hi all forum members. I am new here and am unsure what category shoild I post this in.
Moderator
Inserting 100x and 100y coordinates in mysql table - easy
Is there a way to insert this data into a mysql table named 'map' with the fields: 'x int 3' , 'y in
Consuming third party Payment Gateway API from Procedure.
Hi All,
First of all i would like to thank all the people of the oracle forum for providi
Placing and array within an array then sorting it!
I have a page that runs two large mysql queries and saves the results into arrays, in php I then per
Php script to read msword file
hi,
I need to read a msword file and i want to print the contents in that word file.
i