<./>.dev./hood

$stmt->free_result() frees up memory related to a result set, whereas $stmt->close() frees up memory related to a prepared statement. Subsequently calling $stmt->close() will cancel any result still remaining.

In essence, calling $stmt->close() will provide the same effect as calling $stmt->free_result() since it cancels the result set as well. But calling $stmt->free_result() will not clear out the memory used by the prepared statement in which case you must use $stmt->close().

As far as which one to use goes - there may be situations where you intend on using the prepared statement you have initialized, but are no longer in need of the result set you currently have. In such a case you would wait on calling $stmt->close() until you are done with the prepared statement and instead call $stmt->free_result() before executing another statement.



자꾸 헷갈려서 남김.




참고 URL -

https://stackoverflow.com/questions/19531195/stmt-close-vs-stmt-free-result

'Server Side > PHP' 카테고리의 다른 글

[코드이그나이터] 세그먼트 라이팅 매핑 (파라미터)  (0) 2019.12.05
codeigniter + summernote + ajax  (0) 2019.06.21
php 소괄호 {} 이용 이유  (0) 2017.09.26
while array list each  (0) 2017.08.03
php json여러 줄 일때  (0) 2017.06.21