close ad
WARNING PC USERS: Do Not Install the DREAMWEAVER CC 2017 Update »
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Multiple update records does not work. Please help

Thread began 2/24/2011 4:48 pm by danny405167 | Last modified 2/25/2011 3:29 pm by Jason Byrnes | 1199 views | 4 replies |

danny405167

Multiple update records does not work. Please help

I have been trying to create a simple multi update page but it does not update my records.
I have been reading some threads were people have had the same problem I am having right now. I follow their solution in rearranging the code that gets written in the side the form but no luck. Below is the original code the wizard wrote on my page.

<form action="" method="post">
<table border="1">
<?php do { ?>
<tr>
<?php
// RepeatSelectionCounter_1 Begin Loop
$RepeatSelectionCounter_1_IterationsRemaining = $RepeatSelectionCounter_1_Iterations;
while($RepeatSelectionCounter_1_IterationsRemaining--){
if($RepeatSelectionCounterBasedLooping_1 || $row_Recordset1){
?>
<td>QTy</td>
<td><input type="hidden" name="WADA_RepeatID_detailsID_<?php echo $RepeatSelectionCounter_1; ?>" id="WADA_RepeatID_detailsID_<?php echo $RepeatSelectionCounter_1; ?>" value="<?php echo $row_Recordset1["detailsID"]; ?>" />
<input name="qty_<?php echo $RepeatSelectionCounter_1; ?>" type="text" id="qty_<?php echo $RepeatSelectionCounter_1; ?>" value="<?php echo $row_Recordset1['quantity']; ?>" /></td>
<?php
} // RepeatSelectionCounter_1 Begin Alternate Content
else{
?>
<td>No records match your request.</td>
<?php } // RepeatSelectionCounter_1 End Alternate Content
if(!$RepeatSelectionCounterBasedLooping_1 && $RepeatSelectionCounter_1_IterationsRemaining != 0){
if(!$row_Recordset1 && $RepeatSelectionCounter_1_Iterations == -1){$RepeatSelectionCounter_1_IterationsRemaining = 0;}
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
}
$RepeatSelectionCounter_1++;
} // RepeatSelectionCounter_1 End Loop
?>
</tr>
<?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>
</table>


<input type="submit" name="button" id="button" value="Submit" />
<br />
</form>

Sign in to reply to this post

Jason ByrnesWebAssist

please compress the php page into a zip archive and attach the zip file to your post so i can see the entire code in context rather than just the form.

Sign in to reply to this post

danny405167

Here is the compressed code

I have tried this but no luck
<?php do { ?>
<?php
// RepeatSelectionCounter_1 Begin Loop
$RepeatSelectionCounter_1_IterationsRemaining = $RepeatSelectionCounter_1_Iterations;
while($RepeatSelectionCounter_1_IterationsRemaining--){
if($RepeatSelectionCounterBasedLooping_1 || $row_Recordset1){
?>
<tr>



</tr>
<?php
} // RepeatSelectionCounter_1 Begin Alternate Content
else{
?>
<td>No records match your request.</td>
<?php } // RepeatSelectionCounter_1 End Alternate Content
if(!$RepeatSelectionCounterBasedLooping_1 && $RepeatSelectionCounter_1_IterationsRemaining != 0){
if(!$row_Recordset1 && $RepeatSelectionCounter_1_Iterations == -1){$RepeatSelectionCounter_1_IterationsRemaining = 0;}
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
}
$RepeatSelectionCounter_1++;
} // RepeatSelectionCounter_1 End Loop
?>
<?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>

Attached Files
order_Details.zip
Sign in to reply to this post

danny405167

Problem solved

The suggestions that I found on the forums did not work for me. I simply needed to add the key index to my recordset. But I have one question and I hope you can direct me in the right direction.

I need to update the total amount every time I change the quantities. I have unitPrice field, total field which will be updated, and the total field which equals price x quantity.

Example, in my database I have record 1 with unit price =2.00, qty =3, & total =6
When I update the quantity from 3 to 5, the total should automatically be updated in the database to 10. I know that I need to create a hidden field with a value of unitPrice* ?

Sign in to reply to this post

Jason ByrnesWebAssist

in this case, I would not store the total in the database at all, i would either calculate the total in the recordsets i create:
SELECT *, FORMAT(price * qty,2) AS total FROM tablename


or i would calcualte it in the php:
<?php echo($row_Recordset1['price'] * $row_Recordset1['qty']); ?>

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...