Welcome Guest, Not a member yet? Register   Sign In
Help me please in Controller
#1

[eluser]Unknown[/eluser]
Code:
<?php
    require "AutoF_In.php";
    
    class AutoF_Action extends Controller {

        private $a_data;
        public function A_Insert() {
            if (isset($a_data));
                $query = $this->db->insert('',$this->a_data);
        }
        public function A_Delete($a_id) {  
            
        }
        
        public function A_Update($a_id) {  
            
        }
        public function __construct() {
            $this->a_data = array();
            foreach ($_POST as $var => $value) { $t = array($var => $value);
            array_push($this->a_data,$t); }
            print_r($this->a_data);
            
        }
    }
    $temp = new AutoF_Action();
    $temp->A_Insert();
    //if (crypt("None",$_POST['a']) == $_POST['a']) {
    //    $temp->db->insert();
    //}
    
?>

A PHP Error was encountered

Severity: Notice

Message: Undefined property: AutoF_Action::$db

Filename: AutoF/AutoF_Action.php

Line Number: 9

AutoF_in.php

Code:
<?php
    $dir_autoF = "AutoF";
    $dirLib = "./CodeIgniter_1.7.0";
    require $dirLib."/index.php";
    require $system_folder."/application/config/database.php";
?>

Help me please
#2

[eluser]TheFuzzy0ne[/eluser]
The filename should be "autof_action.php", and the class name should be "Autof_action". CodeIgniter conventions state that for controllers, the file name should be all lowercase, and the class name should have the first letter capitalised.

Hope this helps.
#3

[eluser]srisa[/eluser]
Looks like you have coming from Zend. Load the database library in the constructor, $this->load->database(); You need not include the AutoF_in.php .
#4

[eluser]umefarooq[/eluser]
hi if you want to include the AutoF_in.php its better to create library of your code and use it. its better than including any file. and you can access the code and functionality easily in any controller.




Theme © iAndrew 2016 - Forum software by © MyBB