Solved

Creating  a  product base catalog database for my Website in PhpMyAdmin

Posted on 2010-08-18
7
563 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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
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…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

758 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now