phpmyadmin help for a newbie
Posted: Fri Jul 27, 2007 4:50 pm
feyd | Please use
MySQL said:
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '1) NOT NULL COMMENT 'm=0, f=1', `dob` DATE NOT NULL COMMENT 'Date of Birth', `sc' at line 1
feyd | Please use[/syntax]
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
hello, I am trying to create my first table of my first DB. I am using phpmyadmin to set up my tables, but I am having some dificulty. After laying out the structure of my table in the GUI it shows my the php code that it will be using to design the table, but there is an error that I'm not undertanding. That code in a moment, first let me also say that there is a comment field at the end of each row and I am assuming that this is just for a commented out note to describe the field or it's attributes, is that not what the comment field is used for? Also what data type do I need to use for a field that has a either a "M" or "F" (male/female)? I was thinking from my reading that it was either Boolean or Enum, but I don't really see any way to set the possible values in phpmyadmin. I have only been studying PHP and MySQL for a few weeks, so any feedback is appreciated.
Here is the code that PHPMyAdmin produced with the error message at the bottom:
[syntax="sql"]
CREATE TABLE `student_info` (
`SID` SMALLINT( 5 ) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY COMMENT 'Student ID',
`first_name` VARCHAR( 16 ) NOT NULL ,
`Last_name` VARCHAR( 20 ) NOT NULL ,
`sex` ENUM( 1 ) NOT NULL COMMENT 'm=0, f=1',
`dob` DATE NOT NULL COMMENT 'Date of Birth',
`school` VARCHAR( 30 ) NULL ,
`phone` VARCHAR( 10 ) NULL COMMENT 'students phone',
`email` VARCHAR( 30 ) NULL COMMENT 'students email',
`active` ENUM ON UPDATE CURRENT_TIMESTAMP NOT NULL COMMENT 'current student=1',
`last_update` DATETIME NOT NULL COMMENT 'last time this record was updated',
`registration_date` DATE NOT NULL ,
`med_issues` ENUM NOT NULL DEFAULT '0' COMMENT 'has medical issue=1',
`par_id` SMALLINT( 5 ) NOT NULL COMMENT 'Parent ID',
INDEX ( `first_name` , `Last_name` , `dob` , `active` , `last_update` , `registration_date` ) ,
FULLTEXT (
`first_name` ,
`Last_name` ,
`school`
)
) ENGINE = innodb #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '1) NOT NULL COMMENT 'm=0, f=1', `dob` DATE NOT NULL COMMENT 'Date of Birth', `sc' at line 1
feyd | Please use[/syntax]
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]