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
Why does first ever HttpSendRequest take longer?
I promise this isn't as simple as it sounds. I'm wondering why the the first ever call to HttpSendRe
Word filter problem
Hello,
im trying to make a filter for words inputted in to my website but i want to store the
dropdown menu
Hello everbody,
I am php newbie.
I need to develop a program that once click the drop do
More pug propaganda.
http://www.youtube.com/watch?v=8Kkrmubsgf8
The commercial is definitely worth watching pug aw
bit of help needed
Im about to sort out my registration page for my website by customising a "registration" s
displaying email without attracting a ton of spam
Hello,
this is maybe the wrong place to ask.
How would you display an email address on a w
Custom CMS
This is a big custom CMS script I'd like to develop and would like some help atleast figuring out wh
RFQ Configuration - can you make PLANT field an optional field in ME42
Is there a way to make the plant field on an RFQ optional in change mode (ME42)?
Need help with a mail notify function
I was tasked with setting up a site that's been prewritten. The site is basically a form that captur
set xml path in flash when xml created in memorystream and webrequest
i am creating an xml file using memory stream and i want to load this xml file into the flash on cli