Php 尝试在数据库中保存付款信息,但未成功
我试图在“付款”表中保存有关付款的信息,但未成功。我正在使用这个函数:Php 尝试在数据库中保存付款信息,但未成功,php,paypal,phpmyadmin,codeigniter-3,Php,Paypal,Phpmyadmin,Codeigniter 3,我试图在“付款”表中保存有关付款的信息,但未成功。我正在使用这个函数: public function storeTransaction($data = array()){ $insert = $this->db->insert('payments',$data); return $insert?true:false; } 完整的支付模型如下所示: <?php defined('BASEPATH') OR exit('No direct sc
public function storeTransaction($data = array()){
$insert = $this->db->insert('payments',$data);
return $insert?true:false;
}
完整的支付模型如下所示:
<?php defined('BASEPATH') OR exit('No direct script access allowed');
class Payment extends CI_Model{
function __construct() {
$this->load->database();
}
/*
* Fetch payment data from the database
* @param id returns a single record if specified, otherwise all records
*/
public function getRows($id = ''){
$this->db->select('id,name,image,price');
$this->db->from('products');
if($id){
$this->db->where('id',$id);
$query = $this->db->get();
$result = $query->row_array();
}else{
$this->db->order_by('name','asc');
$query = $this->db->get();
$result = $query->result_array();
}
return !empty($result)?$result:false;
}
//insert transaction data
public function storeTransaction($data = array()){
$insert = $this->db->insert('payments',$data);
return $insert?true:false;
}
}