我正在尝试用PHP脚本做一些MYSQL Concat,因为我想在它上面添加一个PHP条件,但它不起作用。
'concat("<input type=\"checkbox\" value=\"", sup.sup_id, "" "\" name=\"supplier_id[]\" <?=(in_array(\", sup.sup_id,"" "\", $suppliers) ? \"checked\" : \"\") ?> >") AS Select"');
没有PHP脚本的复选框工作正常,但是当我添加脚本时,脚本无效。复选框旁边显示>
。
我认为我在关闭脚本时遇到了麻烦,使这个工作正常的方法是什么?
修改
以下是一些细节
$select = array('sup.sup_name AS "Company Name"','suppro.suppro_price AS "Price"',
'concat("<input type=\"checkbox\" value=\"", sup.sup_id,"" "\" name=\"supplier_id[]\" <?=(in_array(\"", sup.sup_id,"" "\",$suppliers) ? \"checked\" : \"\") ?> >") AS "Select"');
$where = array('prod.pro_id' => $item_id);
$result = $this->canvas->getItemCanvas($select, $where, 'crts_products prod');
$actions = array();
$total_rows = 0;
$this->_data['suppliers'] = $suppliers;
$this->_data['flashsuccess'] = $this->session->flashdata('msg');
$this->_data['pr_id'] = $pr_id;
$this->_data['item_id'] = $item_id;
$this->_data['qty'] = $qty;
$this->_data['header'] = 'Canvas Company for Item<br><small>'.$item_name.' QTY: '.$qty.'</small>';
$this->_data['listing'] = table_listing('user',$result, $total_rows,$offset, $this->_limit, $actions, 3, false,'','');
$this->_data['form_url'] = user_url().'canvas/save_canvas/';
$this->set_template('user/canvas/begin',$this->_data, 'user');
这是工作截图 enter image description here 但是当我在concat中添加PHP脚本时,这就是它的样子 enter image description here