Advanced Web Server Manager
Complete File Manager & Terminal - Standalone Version
By Sid Gifari | Gifari Industries
Current path:
/
/
home
/
qtdcvxyp
/
public_html
/
sms
/
_
/
online
/
smart_school_online_course_src
/
step-2
/
application
/
models
✏️
Editing: Guest_model.php
<?php if (!defined('BASEPATH')) { exit('No direct script access allowed'); } class Guest_model extends MY_Model { public function __construct() { parent::__construct(); } public function add($data) { $this->db->trans_start(); # Starting Transaction $this->db->trans_strict(false); # See Note 01. If you wish can remove as well //=======================Code Start=========================== if (isset($data['id'])) { $this->db->where('id', $data['id']); $this->db->update('guest', $data); $message = UPDATE_RECORD_CONSTANT . " On guest id " . $data['id']; $action = "Update"; $record_id = $insert_id = $data['id']; $this->log($message, $record_id, $action); } else { $this->db->insert('guest', $data); $insert_id = $this->db->insert_id(); $message = INSERT_RECORD_CONSTANT . " On guest id " . $insert_id; $action = "Insert"; $record_id = $insert_id; $this->log($message, $record_id, $action); // return $insert_id; } //======================Code End============================== $this->db->trans_complete(); # Completing transaction /* Optional */ if ($this->db->trans_status() === false) { # Something went wrong. $this->db->trans_rollback(); return false; } else { return $insert_id; } } }
💾 Save Changes
❌ Cancel