Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 599
  • Last Modified:

Creating a product base catalog database for my Website in PhpMyAdmin

I am creating  product database for my web site, I want  to know what I have to put for  the data type characteristic , under  default section,  it gives me a choice of  NONE, AS DEFINED, NULL, CURRENT_TIMESTAMP

these are my   fields:
 itemID  
 itemName,
 itemType,
 itemDescription,
 price ,
 pix
0
imagekrazy
Asked:
imagekrazy
  • 2
  • 2
  • 2
  • +1
1 Solution
 
deisrobinsonCommented:
Just use NONE
0
 
cyberpunk71Commented:
Your not very clear on what exactly you need but this might get you started. Here is how I would do it. You may need to modify the field sizes.

CREATE TABLE `product` (
  `itemID` int(11) NOT NULL auto_increment,
  `itemName` varchar(100) default NULL,
  `itemType` varchar(100) default NULL,
  `itemDescription` text,
  `price` int(11) default NULL,
  `pix` blob,
  PRIMARY KEY  (`itemID`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

The data type characteristics may be confusing you. You don't have to choose an option there.
0
 
imagekrazyAuthor Commented:
It gave me an
Error

SQL query:

CREATE TABLE `AllizonCatalog`.`storeItems` (
`itemID` SERIAL NOT NULL DEFAULT 'NOT NULL' AUTO_INCREMENT PRIMARY KEY ,
`itemName` VARCHAR( 100 ) NOT NULL DEFAULT NULL ,
`itemType` VARCHAR( 100 ) NOT NULL DEFAULT NULL ,
`itemDescription` TEXT NOT NULL ,
`price` INT( 11 ) NOT NULL DEFAULT NULL ,
`pix` BLOB NOT NULL
) ENGINE = MYISAM ;

MySQL said: Documentation
#1067 - Invalid default value for 'itemID'
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
deisrobinsonCommented:
Do it the way you were originally doing it just user "NONE" as data type characteristic as it is not required.
0
 
cyberpunk71Commented:
The "   '   " came across wrong on this website. Sorry.
CREATE TABLE 'product' (
  'itemID' int(11) NOT NULL auto_increment,
  'itemName' varchar(100) default NULL,
  'itemType' varchar(100) default NULL,
  'itemDescription' text,
  'price' int(11) default NULL,
  'pix' blob,
  PRIMARY KEY  ('itemID')
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

Open in new window

0
 
imagekrazyAuthor Commented:
thanks, and I want to know when i put my info in my database, there is function section what do i put  in that from the drop down section? and value section also.
thanks
0
 
Mark BradyCommented:
Don't use the "Function" drop down. That is only if you need to do some math type processing on the data you are entering - like excell does. you only need to worry about the "value" of the data you are entering. In your "insert" statements you need only worry about which columns you want to fill with data and the data itself. Here is a quick example in PHP.

mysql_query("INSERT INTO products (product_name,price,category,qty) VALUES ('$product_name',$price,'$category',$qty) or die(mysql_error());

That code assumes you have already got values inside the php variables. If you have (and you should have) and "id" column which is normally set to "auto inc" so it generates the next number up each time you enter data, you do not need to worry about putting any value in for auto increment columns. Any values that contain text data like names and descriptions, you need to enclose the php variable in single quotes (or double) but for numerical (integer) values you just put the php variable name into the statements. Let me know if you have problems inserting your data - you will need to give me what you are trying to insert and some sample data and I will write the insert code for you. Hope this helps.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 2
  • 2
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now