When to close Prepared Statement

前端 未结 2 1708
眼角桃花
眼角桃花 2020-12-30 23:30

When to close prepared statements in PHP?

Example:

    $query = \"insert into web_reviews (title,added_date,reviewer_home_url,read_more_link,summary)         


        
2条回答
  •  青春惊慌失措
    2020-12-30 23:56

    I am unable to comment currently, so I am just providing an answer. When you run a prepared statement that queries the database for a result, it will not execute another query unless you remove the current result it is storing. $result = $stmt->get_result(). Secondly, If you will need the result from the first query to be saved so that you use it later, then I recommend using two result sets. The first stores the result from the first execution of $stmt and the second for the second execution. This might not answer the question directly, but it may help someone.

提交回复
热议问题