webmasters
webmasters

Reputation: 5851

How to use mysqli_free_result in OOP style?

I am fiddling with mysqli and I have a question about mysqli_free_result() method. (or is it a function? still have to learn OOP).

If I run the code in procedural way I call the function like this:

/*
Destroy the result set and free the memory used for it.
*/
mysqli_free_result($result);

How do I runt this function in OOP style?

$mysqli->free_result(); // does not work. Any ideas why?

Should I not free the results and just close the connection after my mysqli work is done, at the end with:

$mysqli->close;

Upvotes: 1

Views: 4209

Answers (1)

John Conde
John Conde

Reputation: 219934

You forgot the parenthesis for the method calls. Also, free_result() is a method for the mysqli_stmt class and not the mysqli class.

$mysqli_stmt->free_result();
$mysqli->close();

Upvotes: 2

Related Questions