When to close Prepared Statement

前端 未结 2 1705
眼角桃花
眼角桃花 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:57

    That is a good use of close, especially since you are planning on making another query. With both PDO statements and MySQLi statements, I find that erring on the side of cleanliness is almost always for the best -- it removes potential bugs down the line.

    As to the gentlemen with 250 operations... I don't see what the real use case is. Why does he need to query the database 250 different times? Why can't he query the database once with 250 records? Or, more likely, why can't he query the database 25 times with 10 records?

提交回复
热议问题