0
我已阅读用户指南和教程的这个显示单选按钮,我还是新国际展览局在这个时候代码点火器这么难了解它, 我怎样才能在单选按钮检查?如何从数据库中使用笨
非常感谢
这里是我的控制器
public function updateProduct($id)
\t {
\t $data['product'] = $this->products_model->getProduct($id);
$this->load->view('update_product_view', $data);
\t }
\t
\t public function updateProductDb()
\t {
\t $data=array(
\t \t \t \t \t 'nama'=>$this->input->post('nama'),
\t \t \t \t \t 'umur'=>$this->input->post('umur'),
\t \t \t \t \t 'hoby'=>$this->input->post('hoby'),
\t \t \t \t \t 'jk'=>$this->input->post('jk'),
\t \t \t \t \t 'alamat'=>$this->input->post('alamat'));
\t \t $condition['id'] = $this->input->post('id');
\t \t $this->products_model->updateProduct($data, $condition);
\t \t redirect('products');
\t \t }
here is my model
<?php
//File products_model.php
\t class Products_model extends CI_Model {
\t \t function __construct() { parent::__construct(); } function getAllProducts() {
\t \t //select semua data yang ada pada table msProduct $this--->db->select("*");
\t \t $this->db->from("anggota");
\t \t return $this->db->get();
\t }
\t
\t //iNI BERFUNGSI UNTUK GET DATA YANG DI PILIH BERDASARKAN ID ATAU USER YANG KLIK */
\t function getProduct($id)
\t {
\t \t //select produk berdasarkan id yang dimiliki \t
$this->db->where('id', $id); //Akan melakukan select terhadap row yang memiliki productId sesuai dengan productId yang telah dipilih
$this->db->select("*"); // SELECT ALL
$this->db->from("anggota"); //TABEL
return $this->db->get();
\t }
\t function addProduct($data)
\t {
\t //untuk insert ke database
\t $this->db->insert('anggota',$data);
\t }
\t
\t function updateProduct($data, $condition)
\t {
\t \t //update produk
$this->db->where($condition); //Hanya akan melakukan update sesuai dengan condition yang sudah ditentukan
$this->db->update('anggota', $data); //Melakukan update terhadap table msProduct sesuai dengan data yang telah diterima dari controller
\t }
\t function deleteProduct($id)
\t {
\t \t //delete produk berdasarkan id
$this->db->where('id', $id);
$this->db->delete('anggota');
\t }
\t
\t }
这种观点
<input type="text" name="jk" value="<?php echo $detail->jk; ?>">
它通过使用这个父亲 hoby ==“Lari”)'); ?> />拉里 \t \t \t \t \t \t \t HOBY ==” Berenang“)'); ?> /> Berenang – 2014-10-20 10:26:44
顺便说一句,谢谢你的答复:D – 2014-10-21 01:52:13