Solved

Creating  a  product base catalog database for my Website in PhpMyAdmin

Posted on 2010-08-18
7
565 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

This article will explain how to display the first page of your Microsoft Word documents (e.g. .doc, .docx, etc...) as images in a web page programatically. I have scoured the web on a way to do this unsuccessfully. The goal is to produce something …
Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
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 …

895 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

14 Experts available now in Live!

Get 1:1 Help Now