Today, when I wrote a data import, I came up with the mysql tutorial server has gone away. At first glance, I thought it was a database tutorial, but the other was normal. I found it from my website, the reason is that the SQL statement is too long and exceeds the size of max_allowed_packet. If so, the SQL statement is carefully checked as follows:
While ($ rs = mysql_fetch_array ($ query ))
{
$ OS = autoaddlink ($ OS );
Insert... save data,
}
The function is as follows:
Function autoaddlink ($ str)
{
$ Spath = '{cmspath }';
$ SQL = "select typename, id, typedir from cmd_arctype where topid <> 175 ";
$ Query = mysql_query ($ SQL) or die (mysql_error ());
$ Tmps tutorial tr = strtolower ($ str );
While ($ rs = mysql_fetch_array ($ query ))
{
$ Rs ['typename'] = strtolower (str_replace ('cell phone theme ', '', str_replace ('Theme','', str_replace ('nokia ','', $ rs ['typename']);
$ Tmpstr = str_replace ($ rs ['typename'], "<a href = "". str_replace ($ spath, '', $ rs ['typedir']). ""> ". $ rs ['typename']. "</a>", $ tmpstr );
}
Return $ tmpstr;
}
From the perspective of the code, we can't find it.
$ OS = autoaddlink ($ OS );
Insert... save data,
If you do not place the SQL statement in the while LOOP alone, there is no problem. If you place the SQL statement in it, it may take too long to import the SQL statement. I won't say it because it is a variable survival problem.