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
this code is not working????
it says this error.. Warning: Division by zero in ..
the variables are correct, so why is th
str_replace help
Hey there,
I'm a PHP newb, I'm having troubles with the str_replace function. I want to clean
my code does not work.
I have a code problem.
Quote"<a href=index.php?gogo=ureticidetay&'?l={$le
Include with Parameters
In a particular page I would like to include a file that requires $_GET parameters.
when I go
Track downloads' status
Hello,
I need to make somehow, some system, to track whether downloads are completed or faile
Warning: mysql_num_rows() supplied argument is not a valid MySQL result resource
This may be simple I just may need another pair of eyes..
When i get records back the below c
update 2 columns by doing inner 2-column query
Hi,
is something like this possible?
update contract_all set col1,col2 =
(
Change of partner analyse in sales orders
Hello,
I changed the partner analyse for sales orders and added a new mandatory partnerro
Which practice of iteration through containers is preferred
In the "real world" what kind of loop do most people use to iterate through a container like a vecto
Can you help please? Php file
I have to write this php file to allow users to register their nicknames on nickserv
For an I