0

I want to print query before inserting in database in CODEIGNITER.

PHP CODE :

    $data['prices'] = $prices;
    $data['countryID'] = '0';
    $data['userTypeID'] = $roleType;
    $data['districtDivisionID'] = '0';
    $data['userTypeValue'] = $userTypeValue;
    $data['receiverUserTypeID'] = $receiverUserType;
    $this->db->insert('db_DevicePrices', $data);
Sandeep K.
  • 759
  • 6
  • 18

2 Answers2

2

please use insert_string, please take a look at following example.

$data = array( 
        'name'  = >  $_POST['name'] , 
        'groupname'= >  $_POST['groupname'], 
        'age'   = >  $_POST['age']
);
$this-> db->insert_string('tbl_user', $data);

Refer to this link

quachtinh761
  • 224
  • 1
  • 7
1

You can use $this->db->insert_string() for print insert query before inserting data in database

Example:

$data = array('prices' => $prices, 'countryID' => 0, 'userTypeID' => $roleType,'districtDivisionID'=>0,'userTypeValue'=>$userTypeValue,'receiverUserTypeID'=>$receiverUserType);
$str = $this->db->insert_string('db_DevicePrices', $data);

Refer this link

Hope this will help you.

Rajdip Chauhan
  • 345
  • 2
  • 11