Home > php教程 > PHP源码 > body text

php 删除mysql数据库的重复记录

PHP中文网
Release: 2016-05-25 17:11:02
Original
1097 people have browsed it

<?php
set_time_limit(13600);  //设置时间
$conn=mysql_connect(&#39;localhost&#39;,&#39;root&#39;,&#39;&#39;); //连接数据库
mysql_select_db(&#39;shuju&#39;,$conn);
mysql_query("set names &#39;gbk&#39;");

$query = mysql_query("select min(id) as mid from taobaoguanjianci group by title");   

while($row = mysql_fetch_array($query))
 {

mysql_query("INSERT into taobaoguanjiancitmp select id,cid,title,cat,level3,cname from taobaoguanjianci where id=$row[mid]");
 }
?>
Copy after login

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!