使用bind_result&fetch()或store_result()代替get_result

How do I change this function to another function. I don't want to use the get_result

I searched online but could not find an answer that could help me.

public function Select($Table_Name, $Conditions='' ,$Array_Conditions_Limit=NULL , $OrderBy='', $Limit='', $Selected_Fields='*')
{
    $Query = "SELECT ".$Selected_Fields." FROM ".$Table_Name;
    if(!empty($Conditions))
        $Query .= " WHERE ".$Conditions;
    if(!empty($OrderBy))
        $Query .= " ORDER BY ".$OrderBy;
    if(!empty($Limit))
        $Query .= " LIMIT ".$Limit;

    $Statment = $this->ConnectionResult->prepare($Query);
    if(isset($Array_Conditions_Limit)  )
     {
        $Statment = $this->DynamicBindVariables($Statment, $Array_Conditions_Limit);
        $Statment->execute();
        return $Statment->get_result();
     }
     else
        $Statment->execute();
        return $Statment->get_result();
}

This also functions dynamic bind variables

private function DynamicBindVariables($Statment, $Params)
{
    if (is_array($Params) && $Params != NULL)
    {
        // Generate the Type String (eg: 'issisd')
        $Types = '';
        foreach($Params as $Param)
        {
            $Types .= $this->GetType($Param);
        }
        // Add the Type String as the first Parameter
        $Bind_names[] = $Types;

        // Loop thru the given Parameters
        for ($i=0; $i<count($Params);$i++)
        {
            $Bind_name = 'bind' . $i;
            // Add the Parameter to the variable 
            $$Bind_name = $Params[$i];
            // Associate the Variable as an Element in the Array
            $Bind_names[] = &$$Bind_name;
        }
        // Call the Function bind_param with dynamic Parameters
        call_user_func_array(array($Statment,'bind_param'), $Bind_names);
    }
    elseif(isset($Params) && !empty($Params))
    {
        $Types = '';
        $Types .= $this->GetType($Params);
        $Statment->bind_param($Types ,$Params);
    }
    return $Statment;
}

I using the return value as follows:

$myresult =Select('post','post_category=?' ,2  );
                $row = $myresul2->fetch_object()

First of all, I find this approach utterly useless. What are you actually doing is dismembering fine SQL sentence into some anonymous parts.

"SELECT * FROM post WHERE post_category=?"

looks WAY better than your anonymous parameters of which noone have an idea.

'post','post_category=?'

One can tell at glance what does first statement to do. and have no idea on the second. Not to mention it's extreme:

'post','post_category=?',NULL, NULL, 'username, password'

So, instead of this kindergarten query builder I would rather suggest a function that accepts only two parameters - a query itself and array with bound data:

$myresult = Select("SELECT * FROM post WHERE post_category=?", [2]);

To make it more useful, I wouild make separate functions to get different result types, making your second line with fetch_object() obsolete (however, speaking of objects, they are totally useless to represent a table row). Example:

$row = $db->selectRow("SELECT * FROM post WHERE post_category=?", [2]);

Look: it's concise yet readable!

As a further step you may wish to implement more placeholder types, to allow fields for ORDER BY clause be parameterized as well:

$data = $db->getAll('id','SELECT * FROM t WHERE id IN (?a) ORDER BY ?n', [1,2],'f');

you can see how it works, as well as other functions and use cases in my safeMysql library