layman Posted April 1, 2011 Share Posted April 1, 2011 Hello, Could you tell me why is this code not working? I appreciate any help! Thanks. The error I am getting is: #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 'number(5) not null default '', Product_review text(100), Product_brand var' at line 6 Server version: 5.1.41 I have created already the SYSTEM_ADMIN table I am referencing, so that one should not be the problem. Can not see what is the problem with line 6. Can anyone spot it? CREATE TABLE Products ( Grp ENUM('Motherboard', 'HardDrive', 'Processor', 'RAM', 'GraphicCard', 'SoundCard', 'USBPort', 'RouterSwitch', 'Server', 'PowerAdaptor', 'Webcam', 'OperatingSystem', 'Software', 'CaseStyle', 'Speaker', 'FloppyDrive', 'OpticalStorage', 'Monitor', 'Printer', 'Mouse', 'Keyboard') NOT NULL, Serialno varchar(20) not null default '', Product_name text(100) not null default '', line 6 Product_description text(100) not null default '', Product_price number(5) not null default '', Product_review text(100), Product_brand varchar(30), Product_type varchar(30), Product_speed varchar(30), Product_size varchar(30), Product_dimensions varchar(30), Product_on_board_devices varchar(30), Product_form_factor varchar(30), Product_FSB varchar(30), Product_secu_spec varchar(30), Product_techn_stand varchar(30), Product_maxres varchar(30), Product_colour varchar(30), Admin_id int(4) not null, key Serialno(Serialno), PRIMARY KEY (Grp, Serialno), FOREIGN KEY (Admin_id) references SYSTEM_ADMIN(Admin_id) on update cascade on delete cascade ) ENGINE=InnoDB DEFAULT CHARSET=latin1; Quote Link to comment https://forums.phpfreaks.com/topic/232461-could-you-tell-me-why-is-this-code-not-working-i-appreciate-any-help-thanks/ Share on other sites More sharing options...
Pikachu2000 Posted April 2, 2011 Share Posted April 2, 2011 You'll find that 'number' isn't a valid data type. Perhaps you meant INT? Quote Link to comment https://forums.phpfreaks.com/topic/232461-could-you-tell-me-why-is-this-code-not-working-i-appreciate-any-help-thanks/#findComment-1195760 Share on other sites More sharing options...
layman Posted April 2, 2011 Author Share Posted April 2, 2011 Thank you! I changed it to decimal(7,2), but still getting an error. #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 'text not null default '', Product_price decimal(7,2) not null default '', Pr' at line 5 Do you see what the problem is with my table? CREATE TABLE Products ( Grp ENUM('Motherboard', 'HardDrive', 'Processor', 'RAM', 'GraphicCard', 'SoundCard', 'USBPort', 'RouterSwitch', 'Server', 'PowerAdaptor', 'Webcam', 'OperatingSystem', 'Software', 'CaseStyle', 'Speaker', 'FloppyDrive', 'OpticalStorage', 'Monitor', 'Printer', 'Mouse', 'Keyboard') NOT NULL, Serialno varchar(20) not null default '', Product_name varchar(50) not null default '', Product_description varchar(50)text not null default '', Product_price decimal(7,2) not null default '', Product_review varchar(70), Product_brand varchar(30), Product_type varchar(30), Product_speed varchar(30), Product_size varchar(30), Product_dimensions varchar(30), Product_on_board_dev varchar(30), Product_form_factor varchar(30), Product_FSB varchar(30), Product_secu_spec varchar(30), Product_techn_stand varchar(30), Product_maxres varchar(30), Product_colour varchar(30), Admin_id int(4) not null, key Serialno(Serialno), PRIMARY KEY (Serialno), FOREIGN KEY (Admin_id) references SYSTEM_ADMIN(Admin_id) on update cascade on delete cascade ) ENGINE=InnoDB DEFAULT CHARSET=latin1; Quote Link to comment https://forums.phpfreaks.com/topic/232461-could-you-tell-me-why-is-this-code-not-working-i-appreciate-any-help-thanks/#findComment-1195762 Share on other sites More sharing options...
Pikachu2000 Posted April 2, 2011 Share Posted April 2, 2011 Look at the error and compare it to what's in the query. It should be obvious what the problem is . . . Quote Link to comment https://forums.phpfreaks.com/topic/232461-could-you-tell-me-why-is-this-code-not-working-i-appreciate-any-help-thanks/#findComment-1195764 Share on other sites More sharing options...
layman Posted April 2, 2011 Author Share Posted April 2, 2011 Thank you! I think I need some sleep, it is 1.32 am here... Thanks again, really appreciate your help! All the very best, Layman Quote Link to comment https://forums.phpfreaks.com/topic/232461-could-you-tell-me-why-is-this-code-not-working-i-appreciate-any-help-thanks/#findComment-1195765 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.