Php + mysql implement random database shuffling instance _ PHP Tutorial

Source: Internet
Author: User
Php + mysql enables random database shuffling of instances. The main implementation code for php + mysql to implement random database shuffling instances is as follows :? Php database connection is not written here $ sisset ($ _ GET [s])? $ _ GET [s]: 0; $ eisse php + mysql implement random database shuffling instance

The main implementation code is as follows:

The code is as follows:

// The database connection will not be written here
$ S = isset ($ _ GET ['s '])? $ _ GET ['s']: 0;
$ E = isset ($ _ GET ['E'])? $ _ GET ['E']: 50;
$ Count = 85000;
If ($ s <$ count)
{
$ SQL = "select * from table prefix _ info where isget = 0 order by id desc limit $ s, $ e ";
$ Query = mysql_query ($ SQL );
While ($ rs = mysql_fetch_array ($ query ))
{
$ Id = $ rs ['id'];
$ Sss = $ rs ['SS'];
$ Typeid = $ rs ['typeid'];
$ Isget = $ rs ['isget'];
$ SQL = "insert into table prefix _ info_bak (id, table prefix, typeid, isget) values ('$ ID',' $ SS', '$ typeid ', '$ isget ')";
Mysql_query ($ SQL );
Echo $ SQL;
// Exit;
$ Sqlu = "update table prefix _ info set isget = 1 where id =". $ rs ['id'];
Mysql_query ($ sqlu );
}
Echo' Processing data. the current value is '. $ s ......';
}
Else
{
Echo 'process all data and then sort it randomly ';
}
?>

The main implementation code is as follows :? Php // The database connection is not written here $ s = isset ($ _ GET ['s '])? $ _ GET ['s']: 0; $ e = isse...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.