For Programmers: Free Programming Magazines  


Home > Archive > PHP SQL > May 2005 > Mysql Multiple Update in a PHP Web Page









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Mysql Multiple Update in a PHP Web Page
Craig Keightley

2005-05-06, 8:57 am

I need to create a form using multiple quantities that can be updated by one
single update.


eg:
(HTML PAGE)
<form method="post" enctype = "multipart/formdata">
<? do { ?>
<?php echo $row_rsBasket['id']; ?>
<input name="qty" type="text" value="<?php echo $row_rsBasket['qty']; ?>"
size="3">
<? } while ($row_rsBasket = mysql_fetch_assoc($rsBasket)); ?>
<input type="hidden" name="send" value="true">
<input type ="submit" name = "update" value ="update">

How do I create the multiple update when the page is submitted back to
itself?

(TOP OF THE HTML PAGE)
<?
if(isset($_POST['update']) && ($_POST['update'] == "true")){
//loop thorugh each of the submitted qty values this is where I am stuck!!
for each(){
mysql_query = "UPDATE tblCart SET qty = $_POST['qty'] WHERE id = 'ID' // not
sure how to pull out 'ID'
}
}
?>

Any help will be grateful
Craig


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com