Solved

Creating  a  product base catalog database for my Website in PhpMyAdmin

Posted on 2010-08-18
7
569 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
  • 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
Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

 
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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Download tables into separate sheets 3 25
php checkbox validation 5 27
Curl & PHP Command Help 4 22
How is this connection happening? 3 12
Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
These days socially coordinated efforts have turned into a critical requirement for enterprises.
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

776 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