Hi,I'm new to PHP...I currently doing a PHP project....I don't understand this code..can someone please kindly explain to me..Thanks
select * from category c left join category2 c2 on c2.cat1_id=c.cat_id where c.cat_id=" . $_GET['cate1'] . " and c2.cat2_id=" . $_GET['cate2']
What does the c & c2 do?
& what is the output result?
Here the database table:
CREATE TABLE `category` (
`cat_id` bigint(20) NOT NULL auto_increment,
`cat_name` varchar(200) NOT NULL default '',
PRIMARY KEY (`cat_id`)
) TYPE=MyISAM AUTO_INCREMENT= 6 ;
CREATE TABLE `category2` (
`cat2_id` bigint(20) NOT NULL auto_increment,
`cat1_id` bigint(20) NOT NULL default '0',
`cat2_name` varchar(200) NOT NULL default '',
PRIMARY KEY (`cat2_id`)
) TYPE=MyISAM AUTO_INCREMENT= 5 ;
select * from category c left join category2 c2 on c2.cat1_id=c.cat_id where c.cat_id=" . $_GET['cate1'] . " and c2.cat2_id=" . $_GET['cate2']
What does the c & c2 do?
& what is the output result?
Here the database table:
CREATE TABLE `category` (
`cat_id` bigint(20) NOT NULL auto_increment,
`cat_name` varchar(200) NOT NULL default '',
PRIMARY KEY (`cat_id`)
) TYPE=MyISAM AUTO_INCREMENT= 6 ;
CREATE TABLE `category2` (
`cat2_id` bigint(20) NOT NULL auto_increment,
`cat1_id` bigint(20) NOT NULL default '0',
`cat2_name` varchar(200) NOT NULL default '',
PRIMARY KEY (`cat2_id`)
) TYPE=MyISAM AUTO_INCREMENT= 5 ;
Comment