且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在PHP中从文件运行一组SQL查询?

更新时间:2023-02-06 17:48:11


  1. 不要使用 file >除非你真的想要逐行的数据。 file_get_contents()更好。

  2. $ query == file($ file_name); 我不认为你想在这里进行比较。
  3. mysql_query 将只能一次执行一个查询。您必须想出一些方法将您的查询分离出来并逐个运行。

  1. Don't use file() unless you really want the data line-by-line. file_get_contents() is better.
  2. $query==file($file_name); I don't think you want to do a comparison here.
  3. mysql_query will only ever execute a single query at once. You'll have to come up with some way of separating your queries in the file and run them one-by-one.