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>
</tr>
<?php
$wa_startindex = 0;
while(!$rs_ordersinfo->atEnd()) {
$wa_startindex = $rs_ordersinfo->Index;
?>
<tr>
<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> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </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> </td>
<td> </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>
</tr><?php
$rs_ordersinfo->moveNext();
}
$rs_ordersinfo->moveFirst(); //return RS to first record
unset($wa_startindex);
unset($wa_repeatcount);
?>
</table>
<input type="submit" name="Submit1" id="Submit1" value="Update Checkbox Information" />
</form>
code for the recordset and mysqli UPDATE
<?php
error_reporting(E_ALL);
ini_set('display_errors',on);
?><?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'); ?>
<?php
if (!WA_Auth_RulePasses("Logged in to admin")){
WA_Auth_RestrictAccess("admin_login.php");
}
?>
<?php require_once("webassist/database_management/wada_search.php"); ?>
<?php
$searchrs_ordersinfo_1 = new WA_MySQLi_Search("rs_ordersinfo","");
if ($_SERVER["REQUEST_METHOD"] === "POST") {
$searchrs_ordersinfo_1->clearSearch();
$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"]:"") ."");
}
?>
<?php
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]);
$UpdateQuery->execute();
}
if ($MultipleUpdateRedirect) {
if (function_exists("rel2abs")) $MultipleUpdateRedirect = rel2abs($MultipleUpdateRedirect,dirname(__FILE__));
header("location: " . $MultipleUpdateRedirect);
}
}
?>
<?php
$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");
$rs_ordersinfo->execute();
?>