Solved

Creating  a  product base catalog database for my Website in PhpMyAdmin

Posted on 2010-08-18
7
575 Views
Last Modified: 2013-12-13
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
Comment
Question by:imagekrazy
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
  • +1
7 Comments
 
LVL 7

Accepted Solution

by:
deisrobinson earned 500 total points
ID: 33468861
Just use NONE
0
 
LVL 1

Expert Comment

by:cyberpunk71
ID: 33468904
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
 

Author Comment

by:imagekrazy
ID: 33470982
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
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 
LVL 7

Expert Comment

by:deisrobinson
ID: 33474725
Do it the way you were originally doing it just user "NONE" as data type characteristic as it is not required.
0
 
LVL 1

Expert Comment

by:cyberpunk71
ID: 33476805
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
 

Author Comment

by:imagekrazy
ID: 33481646
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
 
LVL 20

Expert Comment

by:Mark Brady
ID: 37762901
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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

759 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question