0

What might I be doing wrong here?

if($stmt = $conn->prepare($sql)){
    $stmt->bind_param('s', $argu);
    if($stmt->execute()){
        $stmt->store_result();
        if($stmt->num_rows > 0){
            $stmt -> bind_result($sid, $ssku);
            while ($stmt -> fetch()) {
                $response[] = compact('sid', 'ssku');
            }
        }
        else{
            $response = [   
                "state"   => "FALSE"
        ];
        }
    }
}
$stmt->free_result();
$stmt->close();
$conn->close();

I am getting this error

Uncaught Error: Call to a member function free_result()

on $stmt->free_result();

Barmar
  • 741,623
  • 53
  • 500
  • 612
Behseini
  • 6,066
  • 23
  • 78
  • 125

0 Answers0