douluozhan4370 2011-11-30 19:51
浏览 17
已采纳

其中POST下一步插入mysql数据库表

I want to get a number from POST and check it against the id column in my table and get the name of this row. In the following code outputting with print_r works, but each of the values I stored in the table order just with the value 0 (but in print_r values them not 0 and is same what i want) how can fix this problem? (i use codeigniter)

$query_cu    = $this->db->get_where('info', array(
    'id' => $this->input->post('number')
))->row();
$query_re    = $this->db->get_where('info', array(
    'id' => $this->input->post('recommend')
))->row();
$query_urf = $this->db->get_where('foreign', array(
    'id' => $this->input->post('name')
))->row();

$data  = array(
    'name' => $query_urf->name,
    'recommend' => $query_re->name,
    'number' => $query_cu->name       
);
$this->db->insert('order', $data);

echo '<pre>';
echo print_r($data1);
  • 写回答

1条回答 默认 最新

  • doucan8521 2011-11-30 20:13
    关注

    What is the structure of your 'order' table? If print_r($data) has the correct info I would double check that the columns have the proper format (text, varchar, etc) to handle the data.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?