Implementation steps:
1. Save the Excel table as a file with the suffix. csv format;
2. Import the. csv format file into the MySQL database;
3. Identify and import the required data into another data table through a conditional query;
Here are some of the PHP fragments:
<?PHPmysql_connect("localhost", "root", "root") or die("Could Not Connect:".)Mysql_error()); mysql_select_db("Test"); mysql_query("SET NAMES ' UTF8 '"); $result=mysql_query("Select Col2, Col5, col6 from category where col2!= '"); Echo"INSERT into ' qy_category ' (' catid ', ' moduleid ', ' catname ', ' catdir ', ' linkurl ', ' parentid ', ' arrparentid ', ' child ', ' Arrchildid ', ' listorder ', ' seo_title ', ' seo_keywords ', ' seo_description ') VALUES "; while($row=Mysql_fetch_array($result,Mysql_assoc)) { //printf ("ID:%s Name:%s", $row ["col2"], $row ["COL5"]); echo "<br/>"; $result 2=mysql_query("Select Col3, Col5, col6 from the category where Col3 like '".$row["Col2"]. " %‘"); $arr=Array(); while($row 2=Mysql_fetch_array($result 2,Mysql_assoc)) { if($row 2["Col6"]== ")$row 2["Col6"]=$row 2["Col5"]; printf('%s ', 4, '%s ', '%s ', ' list.php?catid=%s ', '%s ', '%s ', 0, '%s ', '%s ', '%s ', '%s ', '%s '),$row 2["Col3"],$row 2["Col5"],$row 2["Col3"],$row 2["Col3"],$row["col2"], ' 0, '.$row["col2"]. ', '.$row 2["Col3"],$row 2["Col3"],$row 2["Col3"],$row 2["Col5"],$row 2["Col5"],$row 2["Col6"]); Echo", <br/>"; $arr[]=intval($row 2["Col3"]); } $arrchildid=intval($row["col2"]). ', '.implode(‘,‘,$arr); if($row["Col6"]== ")$row["Col6"]=$row["Col5"]; printf('%s ', 4, '%s ', '%s ', ' list.php?catid=%s ', 0, 0, 1, '%s ', '%s ', '%s ', '%s ', '%s '),$row["Col2"],$row["Col5"],$row["Col2"],$row["Col2"],$arrchildid,$row["Col2"],$row["Col5"],$row["Col5"],$row["Col6"]); Echo", <br/>"; } Mysql_free_result($result); Mysql_free_result($result 2);?>