The ldquo; Generalerror: 2050 rdquo; error occurred when querying mysql in php today. Then ray gave the link, and the problem was solved. As mentioned in the article
The ldquo; General error: 2050 rdquo; error occurred when querying mysql in php today. Then ray gave the link, and the problem was solved. As mentioned in the article
Today, when querying mysql in php, there was a "General error: 2050" error. Later ray gave the link and the problem was fixed.
The article has already been quite clear, and we will directly reference it below:
------------------------------------------
After I upgraded PHP to version 5.2.5, the previously written PDO program always reported the error SQLSTATE [HY000]: General error: 2053. I checked it for a long time before finding a solution to the problem. This problem only occurs when two SQL statements are consecutively requested. The following example shows the problem:
$ S = $ db-> query ("SELECT * FROM test order by poledrugie;"); var_dump ($ s-> fetchAll ()); $ s = $ db-> query ("SELECT * FROM test order by poletrzecie;"); var_dump ($ s-> fetchAll ());
In this case, an error is reported. There are two ways to modify:
1. Replace the handle of the second SQL statement with $ s1.
$ S = $ db-> query ("SELECT * FROM test order by poledrugie;"); var_dump ($ s-> fetchAll ()); $ s1 = $ db-> query ("SELECT * FROM test order by poletrzecie;"); var_dump ($ s1-> fetchAll ());
2. Before the second SQK, clear $ s.
$ S = $ db-> query ("SELECT * FROM test order by poledrugie;"); var_dump ($ s-> fetchAll (); $ s = ''; $ s = $ db-> query ("SELECT * FROM test order by poletrzecie;"); var_dump ($ s-> fetchAll ());
In fact, we can draw a conclusion that if two PDO requests are assigned to the same handle, the second handle will not be overwritten. Therefore, we must manually overwrite it once.