SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Enthusiast
    Join Date
    Aug 2001
    Posts
    30
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Multiple info in one field

    Hi

    I have some code made up for my oscommerce webshop

    Basically its a coupons modification, but im having a problem with my database configuration.

    Basically I can choose multiple products to apply a discount to
    however, when it goes into the database it only stores the 1st one

    how, or where do i get it to store many

    this is my table

    Quote:
    CREATE TABLE IF NOT EXISTS `coupons` (
    `coupons_id` int(10) unsigned NOT NULL auto_increment,
    `coupons_code` varchar(32) NOT NULL,
    `coupons_value` decimal(15,4) NOT NULL,
    `product_ids` int(10) unsigned NOT NULL,
    `type` varchar(32) NOT NULL,
    `num_times` int(11) NOT NULL default '0',
    `total_times` int(11) NOT NULL default '0',
    `coupons_notice` varchar(250) NOT NULL,
    `coupons_min_order` int(11) NOT NULL default '0',
    `coupons_date` date default NULL,
    PRIMARY KEY (`coupons_id`),
    KEY `idx_code` (`coupons_code`)
    ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;
    `product_ids` int(10) unsigned NOT NULL,

    is the row it goes into - how do i make take multiple numbers

    Thanks
    signature

  2. #2
    SitePoint Guru
    Join Date
    Jan 2004
    Location
    Uppsala, sverige
    Posts
    696
    Mentioned
    2 Post(s)
    Tagged
    1 Thread(s)
    Don't store multiple values in one column. Create a separate table with two columns, one for product and for coupon. Store one row for each combination of product and coupon.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •