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
  • 669,327
  • 51
  • 454
  • 560
Behseini
  • 5,746
  • 20
  • 67
  • 114

0 Answers0