Home >Backend Development >PHP Tutorial >PHP sample code to update database in batches

PHP sample code to update database in batches

WBOY
WBOYOriginal
2016-07-25 08:55:25985browse
  1. /**
  2. * Batch update database
  3. * by bbs.it-home.org
  4. */
  5. for($i=1;$i<=$this->size;$i++){
  6. $query[]="update tb_enterprise set eid='$eidex[$i]' where eid=$i";
  7. }
  8. $query_string=implode(";", $query);
  9. $query_result=$db->multi_query($query);
  10. if($query_result){
  11. echo "Successed to update data!";
  12. }else{
  13. echo "Failed to update data!";
  14. }
复制代码


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn