我在txt文件中有几个mysql查询,例如:
INSERT INTO foo VALUES (null,name,age);
UPDATE foo SET name=2,age=30 WHERE id=1;
当我在mysqli_multi_query
中放置这些查询时,会重复查询。所以我有一个插入。我有两个插页。
我会粘贴我的代码:
include("connect.php");
$myfile = fopen("qlist.txt", "r");
$mydata = fread($myfile,filesize("qlist.txt"));
$myfile2 = fopen("tlist.txt", "r");
$mydata2 = fread($myfile2,filesize("tlist.txt"));
$myFinalData = $mydata.$mydata2;
$msql=mysqli_multi_query($con,$myFinalData);
fclose($myfile);
fclose($myfile2);
@unlink("qlist.txt");
@unlink("tlist.txt");
我确信这两个txt文件都有正确的mysql查询而不会被重复。