PHP Code: From the data table plug to select duplicate data
Source: Internet
Author: User
<?php
mysql_connect (' localhost ', ', ', '); Add the appropriate MySQL host name, username, password
mysql_select_db ("); Add the appropriate MySQL database name
$sql = "SELECT * from"; Add the name of the corresponding datasheet
$query = mysql_query ($sql);
$i = 0;
while ($result = Mysql_fetch_array ($query))
{
$SQLSTR = "SELECT * from smsorderinfo where ordermobile = '". $result [' Ordermobile ']. "' and Itemkind = '. $result [' Itemkind ']."'";
echo "Ordermobile =". $result [' Ordermobile ']. " Itemkind = ". $result [' Itemkind ']." \ n ";
echo "Sqlstr =". $sqlstr. " \ n ";
if ($query 1 = mysql_query ($SQLSTR))
{
echo "Success \ n";
while ($result 1 = mysql_fetch_array ($query 1))
{
if ($result [' id ']!= $result 1[' id '))
{
echo "found repetition: Id1 =". $result [' id ']. " Id2 = ". $result 1[' id ']." \ n ";
else echo "######################: Id1 =". $result [' id ']. " Id2 = ". $result 1[' id ']." \ n ";
$sqlstr 2 = "Delete from ' smsorderinfo ' WHERE id = '". $result [' id ']. "'";
echo $sqlstr 2;
if (mysql_query ($sqlstr 2))
{
echo "Delete successful!\n";
}
Else
echo "Delete failed!";
}
}
}
$arry [] = $result [' Ordermobile ']. $result [' Itemkind '];
echo $result [' Zuhe ']. <br> ";
$i + +;
}
echo $i;
?>
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