PHP Developers Network

A community of PHP developers offering assistance, advice, discussion, and friendship.
 
Loading
It is currently Mon Jul 24, 2017 5:43 am

All times are UTC - 5 hours




Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: Fri Jan 17, 2014 2:12 pm 
Offline
Forum Newbie

Joined: Thu Oct 31, 2013 10:50 am
Posts: 24
Quote:
deliveryType
id; INT PRIMARY KEY AUTO_INCREMENT
name; TINYTEXT
description; TEXT
itemId; INT


Users have rights to add custom delivery type, but for default types price must counts automatically. How I can do that? I have an idea to create much one table with itemId column and some BOOL column for storing flag (automatically it counts or no)


Top
 Profile  
 
PostPosted: Fri Jan 17, 2014 2:20 pm 
Offline
Spammer :|
User avatar

Joined: Wed Oct 15, 2008 2:35 am
Posts: 6457
Location: WA, USA
What?

If your problem is finding a way to distinguish default versus non-default delivery types then yeah, I'd probably go for a flag field too.


Top
 Profile  
 
PostPosted: Sat Jan 18, 2014 11:35 am 
Offline
Forum Newbie

Joined: Thu Oct 31, 2013 10:50 am
Posts: 24
Quote:
delivery
deliveryId; INT
itemId; INT
name; TINYTEXT
description; TEXT

deliveryType
id; INT PRIMARY KEY AUTO_INCREMENT
isAutomaticallyCount; BOOL

Asking for critique. I want to find out type of delivery using deliveryType.id and count a price of delivery


Top
 Profile  
 
PostPosted: Sat Jan 18, 2014 5:50 pm 
Offline
Site Administrator
User avatar

Joined: Wed Aug 25, 2004 7:54 pm
Posts: 13417
Location: New York, NY, US
Seems like it should be like this:
Quote:
delivery
id; INT
deliveryTypeId; INT
itemId; INT
name; TINYTEXT
description; TEXT

deliveryType
id; INT PRIMARY KEY AUTO_INCREMENT
isAutomaticallyCount; BOOL

So you could: SELECT delivery.*,deliveryType.isAutomaticallyCount FROM delivery JOIN deliveryType ON delivery.deliveryTypeId=deliveryType.id WHERE deliver.id=42

_________________
(#10850)


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group