Access to a large function can not be implemented correctly, ask the master to help optimize two pieces of PHP code
First paragraph:
PHP Code
Second paragraph:
PHP code
!--code highlighting produced by Actipro Codehighlig Hter (freeware) http://www. codehighlighter.com/-->!--? Php@session_start ();d ate_default_timezone_set (' Asia/shanghai '); $link _id =@ Mysql_ Connect (' localhost ', ' root ', ' password '), if ($link _id) {mysql_select_db (' database '); mysql_query ("Set names ' UTF8 '"); Select Database Gator This sentence} else{echo "Database connection Error!";} $bijiao = "Select Max (Mostcount) from online"; [email& #160;p rotected]_query ($bijiao, $link _id); $most = Intval (@mysql_result ($max, 0)); $time = "Select time from online where mostcount= ' $most '; [email& #160;p rotected]_query ($time, $link _id); [email& #160;p rotected]_result ($time, 0); $already = "Select Max (mostcount) from record"; [email& #160;p rotected]_query ($already, $link _id); $already = Intval (@mysql_result ($already, 0)); if ($most--> $already {$query = "insert into record (Mostcount,time) VALUES ('". $most. "', ' $time ')"; [Email protected]_query ($query);}?
------Solution--------------------
The first and second end algorithms are roughly the same
The second algorithm is a bit of a prank.
If you do max operations on Unindexed current or mostcount, you'll be taking a lot of time
------Solution--------------------
You can index current and mostcount in the database.