close ad
Databridge V2 with MySQLi support IS Now Available!
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

update multiple records with a checkbox

Thread began 1/23/2020 9:21 am by JBWebWorks | Last modified 1/30/2020 9:48 pm by JBWebWorks | 2385 views | 22 replies


update multiple records with a checkbox

I have a page with multiple records from orders placed and a checkbox where the owner reviews the orders, and checks the box to record that she has reviewed a particular order.
In the update multiple records behavior, i'm not sure what value to give the checked box. Currently I have just the value for just the checkbox itself.
I get this error when I try to update.
Fatal error: Uncaught Error: Call to undefined function WA_AB_getLoopedFieldValue() in /home/l4onkda599e9/public_html/orders-for-excel.php:39 Stack trace: #0 {main} thrown in /home/l4onkda599e9/public_html/orders-for-excel.php on line 39

code for the form

<?php /*START_PHP_SIRFCIT*/ if ($rs_ordersinfo->getColumnVal('OrderID')==""){ ?>
<span class="stylered">No records matched your search</span>
<?php } /*END_PHP_SIRFCIT*/ ?>
<form action="" method="post" enctype="multipart/form-data" name="form2" id="form2">
<table width="100%" border="1" cellpadding="5" id="orderinfo">
<tr bgcolor="#0099FF">
<td id="1" width="9%">TOUR</td>
<td id="2" width="9%">NAME</td>
<td id="3" width="6%">ORDER DATE</td>
<td id="4" width="4%">QTY</td>
<td id="5" width="12%">TENT</td>
<td id="6" width="3%">STD AIR MATTRESS</td>
<td id="7" width="3%">DBL AIR MATTRESS</td>
<td id="8" width="3%">QUEEN AIR MATTRESS</td>
<td id="9" width="3%">COFFEE</td>
<td id="10" width="3%">CHAIR</td>
<td id="11" width="3%">TOWEL</td>
<td id="12" width="12%">REQUEST</td>
<td id="13" width="8%">FROM EMAIL</td>
<td id="14" width="4%">GROSS</td>
<td id="15" width="4%">FEE</td>
<td id="16" width="4%">NET</td>
<td id="17" width="4%">PAID BY</td>
<td id="18" width="3%">SHAWN</td>
<td id="19" width="3%" style="display:none">BECKY</td>
$wa_startindex = 0;
while(!$rs_ordersinfo->atEnd()) {
$wa_startindex = $rs_ordersinfo->Index;
<td><?php echo $rs_ordersinfo->getColumnVal('DetailItemDesc'); ?></td>
<td><?php echo $rs_ordersinfo->getColumnVal('BuyerLastName'); ?>, <?php echo $rs_ordersinfo->getColumnVal('BuyerFirstName'); ?></td>
<td><?php echo $rs_ordersinfo->getColumnVal('OrderDate'); ?></td>
<td><?php echo $rs_ordersinfo->getColumnVal('DetailQuantity'); ?></td>
<td><?php echo $rs_ordersinfo->getColumnVal('DetailItemName'); ?></td>
<td><?php echo $rs_ordersinfo->getColumnVal('requests'); ?></td>
<td><?php echo $rs_ordersinfo->getColumnVal('Buyeremail'); ?></td>
<td>$ <?php echo number_format($rs_ordersinfo->getColumnVal('OrderTotal'), 2); ?></td>
<td><?php echo $rs_ordersinfo->getColumnVal('paid_by'); ?></td>
<td><input type="hidden" name="Shawn_wamultihidden[]" id="Shawn_wamultihidden_<?php echo $wa_repeatcount; ?>_<?php echo($wa_startindex); ?>" value="1" />
<input name="Shawn_<?php echo $wa_repeatcount; ?>_<?php echo($wa_startindex); ?>" type="checkbox" id="Shawn_<?php echo $wa_repeatcount; ?>_<?php echo($wa_startindex); ?>" value="1" <?php if (!(strcmp($rs_ordersinfo->getColumnVal('shawn'),1))) {echo "checked=\"checked\"";} ?> />
<input type="hidden" name="WADA_RepeatID_DetailsID[]" id="WADA_RepeatID_DetailsID_<?php echo($wa_startindex); ?>" value="<?php echo($wa_startindex); ?>" /></td>
<td style="display:none"><input name="Becky_<?php echo $wa_repeatcount; ?>_<?php echo($wa_startindex); ?>" type="checkbox" id="Becky_<?php echo $wa_repeatcount; ?>_<?php echo($wa_startindex); ?>" value="1" <?php if (!(strcmp($rs_ordersinfo->getColumnVal('becky'),1))) {echo "checked=\"checked\"";} ?> /></td>
$rs_ordersinfo->moveFirst(); //return RS to first record

<input type="submit" name="Submit1" id="Submit1" value="Update Checkbox Information" />


code for the recordset and mysqli UPDATE

?><?php require_once('Connections/conncomfysqli.php'); ?>
<?php require_once( "webassist/security_assist/helper_php.php" ); ?>
<?php require_once('webassist/mysqli/rsobj.php'); ?>
<?php require_once('webassist/mysqli/queryobj.php'); ?>
if (!WA_Auth_RulePasses("Logged in to admin")){
<?php require_once("webassist/database_management/wada_search.php"); ?>
$searchrs_ordersinfo_1 = new WA_MySQLi_Search("rs_ordersinfo","");
$searchrs_ordersinfo_1->setSearch(array("type"=>"Value", "comparison"=>"=", "join"=>"AND"), array("DetailItemID"), "s", "".((isset($_POST["tour1"]))?$_POST["tour1"]:"") ."");
$searchrs_ordersinfo_1->setSearch(array("type"=>"Value", "comparison"=>"Includes", "join"=>"AND"), array("BuyerLastName"), "s", "".((isset($_POST["name1"]))?$_POST["name1"]:"") ."");
$searchrs_ordersinfo_1->setSearch(array("type"=>"Value", "comparison"=>"Includes", "join"=>"AND"), array("BuyerFirstName"), "s", "".((isset($_POST["name2"]))?$_POST["name2"]:"") ."");
$searchrs_ordersinfo_1->setSearch(array("type"=>"Value", "comparison"=>"Includes", "join"=>"AND"), array("DetailItemName"), "s", "".((isset($_POST["tentpkg1"]))?$_POST["tentpkg1"]:"") ."");
$searchrs_ordersinfo_1->setSearch(array("type"=>"Value", "comparison"=>">=", "join"=>"AND"), array("OrderDate"), "t", "".((isset($_POST["date1"]))?$_POST["date1"]:"") ."");
if (isset($_POST["Submit1"]) || isset($_POST["Submit1_x"])) {
$MultipleUpdateConnection = $conncomfysqli;
$MultipleUpdateTable = "orderdetails";
$MultipleUpdateRedirect = "admin.php";
$MultipleUpdateIndexColumn = "DetailsID";
$MultipleUpdateIndexColumnType = "d";
$MultipleUpdateIdentifier = "WADA_RepeatID_DetailsID";
$MultipleUpdateArray = isset($_POST[$MultipleUpdateIdentifier])?$_POST[$MultipleUpdateIdentifier]:array();
for ($mu=0; $mu<sizeof($MultipleUpdateArray); $mu++) {
$MultipleUpdateCount = $MultipleUpdateArray[$mu];
$UpdateQuery = new WA_MySQLi_Query($MultipleUpdateConnection);
$UpdateQuery->Action = "update";
$UpdateQuery->Table = $MultipleUpdateTable;
$UpdateQuery->bindColumn("shawn", "c", "".WA_AB_getLoopedFieldValue("Shawn_".$wa_repeatcount ."", $WA_multipleUpdateCounter) ."?php echo $wa_repeatcount; ?>", "WA_IGNORE");
$UpdateQuery->addFilter($MultipleUpdateIndexColumn, "=", $MultipleUpdateIndexColumnType, $_POST[$MultipleUpdateIdentifier."_".$MultipleUpdateCount]);
if ($MultipleUpdateRedirect) {
if (function_exists("rel2abs")) $MultipleUpdateRedirect = rel2abs($MultipleUpdateRedirect,dirname(__FILE__));
header("location: " . $MultipleUpdateRedirect);
$rs_ordersinfo = new WA_MySQLi_RS("rs_ordersinfo",$conncomfysqli,0);
$rs_ordersinfo->setQuery("SELECT * FROM orders JOIN orderdetails ON orders.OrderID = orderdetails.DetailOrderID ORDER BY orders.OrderDate DESC");

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





Ease of use


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...