Welcome Guest, Not a member yet? Register   Sign In
in MySQL- Trigger how to use codeigniter Path
#1

Dear All,

I am using - PHP-Codeigniter 2.1.3, MySQL , XAMPP


In MySQL table i added a trigger, In that trigger i want to assign my CONTROLLER Path, if any data insterted into the Table immediately display a PAGE as follows. but showing errors. Highly expecting your kind support…..!!!

Code:
BEGIN
IF NEW.flag = 1 THEN
  DECLARE result CHAR(255);
  SET cmd = CONCAT('E:/xampp/php/php.exe -f "E:/xampp/htdocs/DEN/classes.php"');
END IF;
END
Reply
#2

Why would you need a database trigger for that?
It's very likely that data will only be inserted because you programmed your application to do that.
You can let your controller (or model) check if the data is being inserted succesfully.
If so, make your controller redirect the user to a specific page.

Controller:
PHP Code:
$data = array(
 
 'name' => $this->input->post('name'),
 
 'city' => $this->input->post('city')
);
$i $this->db->insert('mytable',$data);
if (
$i) {
 
  redirect('success_page');
}
else {
 
  redirect('error_page');

Reply




Theme © iAndrew 2016 - Forum software by © MyBB