help me to extract results from an array by a query
Posted: Mon Mar 15, 2010 2:03 pm
ihave three tables 1)maincategories 2)subcategories and 3)products and one of the field in product table is subcatid(varchar) in which iam inserting all the subcateogies to which that product belongs to
The design of the product table is below
productid¦¦ productname ¦¦ maincatid ¦¦ subcatid
1¦¦ Dell¦¦ Computers ¦¦ 12,3,5
2¦¦ Hp ¦¦ Computers¦¦ 3,4,40
3¦¦ Nec ¦¦ Netweorking¦¦ 8,5,16
4¦¦ IBM¦¦ GAteways ¦¦ 20,44,9
5¦¦ Mac ¦¦ Computers ¦¦ 1,90,45
My problem is i want to run a query which extacts the records of the product table by giving a where clause in which i will give the sub catid
like below
$sql="select * products where subcatid=3
so that i can extract the two fields
like
productid¦¦ productname ¦¦ maincatid ¦¦ subcatid
1¦¦ Dell¦¦ Computers ¦¦ 12,3,5
2¦¦ Hp ¦¦ Computers¦¦ 3,4,40
Please help me in this
The design of the product table is below
productid¦¦ productname ¦¦ maincatid ¦¦ subcatid
1¦¦ Dell¦¦ Computers ¦¦ 12,3,5
2¦¦ Hp ¦¦ Computers¦¦ 3,4,40
3¦¦ Nec ¦¦ Netweorking¦¦ 8,5,16
4¦¦ IBM¦¦ GAteways ¦¦ 20,44,9
5¦¦ Mac ¦¦ Computers ¦¦ 1,90,45
My problem is i want to run a query which extacts the records of the product table by giving a where clause in which i will give the sub catid
like below
$sql="select * products where subcatid=3
so that i can extract the two fields
like
productid¦¦ productname ¦¦ maincatid ¦¦ subcatid
1¦¦ Dell¦¦ Computers ¦¦ 12,3,5
2¦¦ Hp ¦¦ Computers¦¦ 3,4,40
Please help me in this