is there any way to access the variables of this function outside ?

            public function selectData($table, $where = null, $wheree = null, $where1 = null, $wheree1 = null) {
                    $QUERY = mysql_query("SELECT * FROM " . $table . " WHERE '" . $where . "' = '" . $wheree . "' && '" . $where1 . "' = '" . $wheree1 . "'");
                    $Fetch_Assoc = mysql_fetch_assoc($QUERY);
                    $Num_Rows = mysql_num_rows($QUERY);
                    $Fetch_Array = mysql_fetch_array($QUERY);
                    $Fetch_Object = mysql_fetch_object($QUERY);

            }

I need it please !!

Please post the whole class structure not only one method.

$Fetch_Assoc, $Fetch_Array, $Num_Rows and $Fetch_Object should be either assigned to some properties or somehow returned by the function. There is a third option which is that these variables were made global but that would defeat the purpose of OOP.

An example (made up, do not copy it):

class $DB_handler
{
    protected $Fetch_Assoc = array();
    protected $Fetch_Array = array();
    protected $Fetch_Object = null;
    protected $Num_Rows = null;

    protected function selectData($table, $where = null, $wheree = null, $where1 = null, $wheree1 = null) 
    {
        $QUERY = mysql_query("SELECT * FROM " . $table . " WHERE '" . $where . "' = '" . $wheree . "' && '" . $where1 . "' = '" . $wheree1 . "'");
        $this->Fetch_Assoc = mysql_fetch_assoc($QUERY);
        $this->Num_Rows = mysql_num_rows($QUERY);
        $this->Fetch_Array = mysql_fetch_array($QUERY);
        $this->Fetch_Object = mysql_fetch_object($QUERY);

    }

    public function getArray
    {
        return $this->Fetch_Assoc;
    }

    public function getAssoc
    {
        return $this->Fetch_Array;
    }
    ...
}

// initialize class
$obj = new $DB_handler;
$obj->SelectData('table_name');
$temp = $obj->getAssoc();
echo $temp['P_id'];
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.