如何使用单个表以不同的形式查看codeigniter中数据库中的多个复选框值



告诉我如何用一个表以不同形式查看codeigniter中数据库中的多个复选框值
这是我已经完成的代码。请帮帮我

这是显示的错误

遇到PHP错误严重性:通知

消息:数组到字符串转换

文件名:database/DB_query_builder.php

行号:683

回溯:

文件:D:\examplep\htdocs\homestaynew\web\application\models\Main_Model.php线路:165功能:其中

文件:D:\examplep\htdocs\homestaynew\web\application\controllers\Main.php线路:929函数:updateData2

文件:D:\examplep\htdocs\homestaynew\index.php线路:315功能:需要一次

发生数据库错误错误编号:1064

您的SQL语法有错误;查看与MariaDB服务器版本对应的手册,以了解在第1行的'134=''WHEREid=Array'附近使用的正确语法

更新hostmain集合134=",其中id=Array

文件名:D:examplep/htdocs/homestaynew/system/database/DB_driver.php

行号:691

视图

<?php foreach ($result as $key => $row) {?>
<input type="hidden" name="id" value="<?= $row['id'] ?>"> 
<input type="hidden" name="propertytype" value="<?= $row['propertytype'] ?>">

<input type="hidden" name="guesthave" value="<?= $row['guesthave']  ?>">
<input type="hidden" name="guestaccomodate" value="<?= $row['guestaccomodate'] ?>">
<input type="hidden" name="bedroomuse1" value="<?= $row['bedroomuse1'] ?>">
<input type="hidden" name="guestbedroom" value="<?= $row['guestbedroom'] ?>">
<input type="hidden" name="guest1" value="<?= $row['guest1'] ?>">
<input type="hidden" name="guest2" value="<?= $row['guest2'] ?>">
<input type="hidden" name="guest3" value="<?= $row['guest3'] ?>">
<input type="hidden" name="guest4" value="<?= $row['guest4'] ?>">
<input type="hidden" name="bedroomuse2" value="<?= $row['bedroomuse2'] ?>">
<input type="hidden" name="guest5" value="<?= $row['guest5'] ?>">
<input type="hidden" name="guest6" value="<?= $row['guest6'] ?>">
<input type="hidden" name="guest7" value="<?= $row['guest7'] ?>">
<input type="hidden" name="guest8" value="<?= $row['guest8'] ?>">
<input type="hidden" name="bedroomuse3" value="<?= $row['bedroomuse3'] ?>">
<input type="hidden" name="bathroom_accomodate[]" value="<?= $row['bathroom_accomodate'] ?>" >
<input type="hidden" name="bathroomused" value="<?= $row['bathroomused'] ?>">
<input type="hidden" name="location" value="<?= $row['location'] ?>">
<input type="hidden" name="amenities[]"  value="<?= $row['amenities']  ?>">
<input type="hidden" name="sharedspaces[]"  value="<?= $row['sharedspaces'] ?>">
<?php  } ?>

控制器

$bathroom_accomodate =implode(',',$this->input->post('bathroom_accomodate'));
$bathroomused = $this->input->post('bathroomused');
$location=$this->input->post('location');
$amenities=implode(',',$this->input->post('amenities'));
$sharedspaces=implode(',',$this->input->post('sharedspaces'));
$components = array(array('component_key' => 'address'),array('component_key' => 'education'));
$client_details = array('address' => 1);
foreach ($components as $key => $value)
{
$data = array('name'          => 'components[]',
'value'         => $value['component_key'],
'checked'       => ($client_details[$value['component_key']] == 1) ? TRUE : FALSE
);
echo "<div class='col-md-4 col-sm-12 col-xs-4 form-group'><div class='checkbox'><label>";
echo form_checkbox($data).$value['component_key'];
echo "</label></div></div>";
echo "<div class='clearfix'></div>";
}

相关内容

  • 没有找到相关文章

最新更新