Wrox Programmer Forums
|
PHP Databases Using PHP in conjunction with databases. PHP questions not specific to databases should be directed to one of the other PHP forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the PHP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 7th, 2006, 01:03 AM
Registered User
 
Join Date: Oct 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to purnendu2311 Send a message via AIM to purnendu2311 Send a message via MSN to purnendu2311 Send a message via Yahoo to purnendu2311
Default query problem

Hello all,

I am tring to execute this condition based query from two table(product & itemdetails),
 where,
 if prod_type from itemdetails is "exclusive"
then
prod_status from product table is inactive
else
prod_status from product table is active.
then

This is my table structure:::::::::::::::

CREATE TABLE `itemdetails` (
  `sno` int(11) NOT NULL auto_increment,
  `cart_id` varchar(60) default NULL,
  `prod_id` varchar(30) default NULL,
  `prod_price` double(5,0) default NULL,
  `prod_desc` varchar(250) default NULL,
  `prod_quantity` int(2) default NULL,
  `prod_type` varchar(20) default NULL,
  `prod_source` varchar(30) default NULL,
  `prod_colour` varchar(30) NOT NULL default '',
  `prod_colno` int(10) NOT NULL default '0',
  PRIMARY KEY (`sno`)
) ENGINE=MyISAM AUTO_INCREMENT=139 DEFAULT CHARSET=latin1;

/*Data for the table `itemdetails` */

insert into `itemdetails` values

(82,'ef253b43f5cbd61142e71b90de6cc327','INF001',45 00,'test',1,'Non-exclusive','.psd,.html','INF001BL',1),

(81,'ef253b43f5cbd61142e71b90de6cc327','HOL001',60 00,'description',1,'Non-exclusive','.psd,.html','HOL001RL',3),

(80,'ef253b43f5cbd61142e71b90de6cc327','BUS001',50 0,'nothing ',1,'Non-exclusive','.psd,.html','BUS001BL',1),

(61,'6bdf65b5714a7bf7f997f51c52d92805','BUS001',10 00,'nothing ',1,'Exclusive','.psd,.html','BUS001GL',2),

(62,'6bdf65b5714a7bf7f997f51c52d92805','BUS003',12 000,'test',1,'Exclusive','.psd,.html','BUS003BL',1 );




CREATE TABLE `product` (
  `sno` int(11) NOT NULL auto_increment,
  `prod_id` varchar(20) NOT NULL default '',
  `prod_desc` text NOT NULL,
  `prod_nonexclusive` double(5,0) default NULL,
  `prod_exclusive` double(5,0) NOT NULL default '0',
  `prod_colour` varchar(50) NOT NULL default '',
  `prod_source` varchar(50) NOT NULL default '',
  `prod_date` date NOT NULL default '0000-00-00',
  `image1_small` longblob,
  `image1_big` longblob,
  `image1_small_type` varchar(20) default NULL,
  `image1_big_type` varchar(20) default NULL,
  `image1_prod_id` varchar(20) NOT NULL default '',
  `image2_small` longblob,
  `image2_big` longblob,
  `image2_small_type` varchar(20) default NULL,
  `image2_big_type` varchar(20) default NULL,
  `image2_prod_id` varchar(20) NOT NULL default '',
  `image3_small` longblob,
  `image3_big` longblob,
  `image3_small_type` varchar(20) default NULL,
  `image3_big_type` varchar(20) default NULL,
  `image3_prod_id` varchar(20) NOT NULL default '',
  `image4_small` longblob,
  `image4_big` longblob,
  `image4_small_type` varchar(20) default NULL,
  `image4_big_type` varchar(20) default NULL,
  `image4_prod_id` varchar(20) NOT NULL default '',
  `prod_status` varchar(20) default NULL,
  PRIMARY KEY (`sno`,`prod_id`),
  UNIQUE KEY `sno` (`sno`),
  KEY `prod_colour` (`prod_colour`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

Plz help me, urgent.

Regards
puru



shopping
 
Old October 19th, 2006, 12:08 AM
Friend of Wrox
 
Join Date: Oct 2003
Posts: 479
Thanks: 0
Thanked 3 Times in 3 Posts
Send a message via MSN to surendran Send a message via Yahoo to surendran
Default

hai,
if($prod_status=="exclusive"){
insert query product table with prod_status inactive
}else{
insert query product table with prod_status active
}

surendran
(Anything is Possible)
http://ssuren.spaces.msn.com





Similar Threads
Thread Thread Starter Forum Replies Last Post
Query Problem. rupen Access 3 April 27th, 2007 07:43 AM
Query Problem bundersuk VB Databases Basics 0 December 30th, 2006 07:50 AM
problem with query harpua Classic ASP Databases 1 January 24th, 2005 12:36 PM
Problem in query leo_vinay Classic ASP Databases 5 January 21st, 2005 06:32 AM
query problem mateenmohd SQL Server 2000 7 September 9th, 2003 11:58 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.