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
phpMailer not working ..........
HI,
I was playing with the phpMailer script and tried to send a smiple mail using their test scri
Database 'Validation'
Hi everyone,
I'm trying to validate the password entered by the user with the password in the dat
Strip Slashes Help
I've got a script that i've downloaded of the net to edit multiple fields from my sql database, and
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
problems with script
I made a small script wich exchanges points in my website:
<?php
session_start
Quick variable question
hey guys/gals,
im trying to write a php script and it works fine as i have it, but i need to set
How do I get the row number from from an sql table query
Hi all
I have a table that I query and it returns a number of rows.
mysql_num_rows($query)
Request for tunning the below query
Hi,
Can any one help me on the below query while improving the performance,
simplexml_load_file and rss problem
Hi,
I have a problem parsing an rss feed using simplexml_load_file - this is strange as i hav
How to submit a form to the same page?
I have a table containing information about books in my library and this table has the following col