$xiaoID =$_post[' Xsid_xiao '];//post min id$daid=$_post[' xsid_da '];//post max id$chaid= "select * from XS where id>= ' $ Xiaoid ' and sid<= ' $daID ' ", $rsID = $mysqli->query ($chaId), while ($rs = $rsID->fetch_assoc ()) { $ming = $rs [' Leiming '];//cycle out the class name; $chaming = "SELECT * from Shitu where toming= ' $ming '"; $cha = $mysqli->query ($chaming); while ($row = $cha->fetch_assoc ()) { $neirong. = $row [' Neirong '];//as many articles under this class, using $neirong. Connect } $ming = Iconv ("UTF-8", "GBK", $ming);//transcoding under Win platform. $wei = '. /txt/'. $ming. TXT ';//Set the build path. $weizhi =fopen ($wei, ' w ') or Die ("can ' t open file"); Fwrite ($weizhi, $neirong);//Generate fclose ($weizhi); $mysqli->close ();}
The skill can only think of these. Can't think of how to deal with, wrong. To modify the request.
1: By ID from small to cycle out the class name,
2: All articles in the circulation class name,
3: Put all the articles under a class into a txt.
Reply to discussion (solution)
Since the mistake, why not put out the mistake.
Since the mistake, why not put out the mistake.
He's not wrong. Submission past is blank. IE hints 500 error.
PHP.ini in order to Display_errors=on
Then restart the server to run and see
PHP.ini in order to Display_errors=on
Then restart the server to run and see
Hehe, the same is the 500 error.
What kind of environment? Clear the cache and see. How about Firefox testing?
set broken part of the problem!
$xiaoID =$_post[' Xsid_xiao '];//post minimum ID
$daID =$_post[' xsid_da '];//post maximum id
$chaId = "SELECT * FROM XS where Id>= ' $xiaoID ' and sid<= ' $daID ' ";
$rsID = $mysqli->query ($chaId);
while ($rs = $rsID->fetch_assoc ()) {
$ming = $rs [' leiming '];//loop out the class name;
$chaming = "SELECT * from Shitu where toming= ' $ming '";
$cha = $mysqli->query ($chaming);
while ($row = $cha->fetch_assoc ()) {
$neirong. = $row [' Neirong '];//as many articles under this class, use $neirong. Connect
}
$ming =iconv ("UTF-8", "GBK", $ming);//transcoding under Win platform.
$wei = '.. /txt/'. $ming. TXT ';//Set the build path.
$weizhi =fopen ($wei, ' w ') or Die ("can ' t open file");
Fwrite ($weizhi, $neirong);//Generate
Fclose ($weizhi);
$mysqli->close ();
}
set broken part of the problem!
$xiaoID =$_post[' Xsid_xiao '];//post minimum ID
$daID =$_post[' xsid_da '];//post maximum id
$chaId = "SELECT * FROM XS where Id>= ' $xiaoID ' and sid<= ' $daID ' ";
$rsID = $mysqli->query ($chaId);
while ($rs = $rsID->fetch_assoc ()) {
$ming = $rs [' leiming '];//loop out the class name;
$chaming = "SELECT * from Shitu where toming= ' $ming '";
$cha = $mysqli->query ($chaming);
while ($row = $cha->fetch_assoc ()) {
$neirong. = $row [' Neirong '];//as many articles under this class, use $neirong. Connect
}
$ming =iconv ("UTF-8", "GBK", $ming);//transcoding under Win platform.
$wei = '.. /txt/'. $ming. TXT ';//Set the build path.
$weizhi =fopen ($wei, ' w ') or Die ("can ' t open file");
Fwrite ($weizhi, $neirong);//Generate
Fclose ($weizhi);
$mysqli->close ();
}
If you do not use $row [' Neirong '] is the 1 articles in this category, loop out to assign to 1 variables, use the variable dot to join, set to synthesize a variable, and then assign to a txt text content, I can not think of a better way. I don't know if there's any other way.
Not that you can't $neirong. = $row [' Neirong ']; Write like this
Instead, the $neirong has no initial value, causing all query results to be appended to it, which may eventually fail due to insufficient memory
Besides, it doesn't fit in with your article. The original purpose of classification
The main problem in the $mysqli->close ();
You are shutting down the database connection in the outer loop, causing the second round of $cha = $mysqli->query ($chaming) when the $xiaoID ≠ $daID; Failed
If you do not turn on PHP error display, it will cause the Web server to appear 500 errors
That's all you have to say.
$sql = "SELECT * from XS, Shitu where Xs.leiming=shitu.toming and XS. Id>= ' $xiaoID ' and xs.sid<= ' $daID ' "; $rsID = $mysqli->query ($sql); while ($rs = $rsID->fetch_assoc ()) { $ ming= $rs [' leiming '];//cycle out the class name; $ming =iconv ("UTF-8", "GBK", $ming);//Go to code under win platform. $wei = '. /txt/'. $ming. TXT ';//Set the build path. file_put_contents ($wei, $rs [' Neirong '], file_append);} $mysqli->close ();