The database is as follows. Cate1 is a big class. There are small classes under each big category.
How to find the following results
ID cate1
1 Protect Phone case Table Protection Power Bank Protection
2 Power Bank Car Charger Wall Charger
3 Keyboard&mouse Keyboard Mouse
4 headphone headphone earphone Bluetooth Headphone
5 bluetooth_speaker Power Bank Car Charger Wall Charger
How do I implement it with SQL statements?
Under each big class, follow his small class as a piece of data and build a new table.
Reply to discussion (solution)
$SQLSTR = "SELECT * FROM table where id<6", $query = mysql_query ($sqlstr) or Die (Mysql_error ()), while ($thread =mysql_fet Ch_array ($query)) { $result [] = $thread;} Print_r ($result);
It is recommended that you consider an infinite class when you start to build the table structure, and then optimize the table to get the better.
Select Cate1, Group_concat (Cate2) as Cate2 from Tbl_name where cate2!= "group by cate1 ORDER by ID
Cate1 cate2 Protect Power Bank protectio,table protection,phone case Power wallcharger,car Charger,power Bank Keyboard&mousemouse,keyboard Headphone
How to do the Infinite class classification, how to optimize?
How the data in Cate2 is extracted into a single result, bounded by commas.
How to do the Infinite class classification, how to optimize?
How the data in Cate2 is extracted into a single result, bounded by commas.
can go to PHP based on the solved module has the Xu boss, specifically to explain the infinite pole classification