1

i don't find error when call a function from another function like this:

FUNCTIONS PHP

class DB_Functions extends DB_Connect{

    private $dbConnect = "";

    public function __construct() {
        $this->dbConnect = $this->pdo_connect();
    }

    public function __destruct() {
        $this->dbConnect = null;
    }

    public function actionOnProfile() {

        //MORE CODE
        $id = $this->dataActionProfile['id'];
        $nombre = $this->dataActionProfile['nombre'];
        $descrip = $this->dataActionProfile['descrip'];

        updateprofile($nombre, $descrip, $id);
    }

    function updateprofile($nombre, $descrip, $id) {
        $sql = "UPDATE cat_perfiles SET Nombre = :nom, Descripcion = :des WHERE Id = :id";

        $result = $this->dbConnect->prepare($sql) or die ($sql);
        $result->bindParam(':nom',$nombre,PDO::PARAM_STR);
        $result->bindParam(':des',$descrip,PDO::PARAM_STR);
        $result->bindParam(':id',$id,PDO::PARAM_INT);

        if (!$result->execute()) {
            return false; 
        }

        $jsonErrorProfile = array();
        $jsonErrorProfile['success'] = 'success';
        return $jsonErrorProfile;
    }
}

Error is when use updateprofile($nombre, $descrip, $id);

Error: 500 Internal Server Error

1
  • 1
    Try checking your error log file for the actual error. Commented Sep 6, 2012 at 21:13

1 Answer 1

3

Because you need to call $this->updateprofile(...);

In php, apart from C++, C#, Java, etc - you need always to specify $this->

Sign up to request clarification or add additional context in comments.

1 Comment

Sure!! Now i will see because return null.. but, work :) Thanks

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.