otuatail Posted February 20, 2013 Share Posted February 20, 2013 I have a large user logon. I decided that as i hate having NULL values I made defaults. I modified the table together with 3 test users. I wanted NOW to test it by entering one record using the primary key. (there is no reference to other tables) Here is what I have minus the 3 rows inserted (This bit works fine). DROP TABLE IF EXISTS `SM3SusersX`; CREATE TABLE IF NOT EXISTS `SM3SusersX` ( `UserF` varchar(15) NOT NULL default '', `UserS` varchar(15) NOT NULL default '', `UserN` varchar(32) NOT NULL default '', `Friendly` varchar(15) NOT NULL default '', `Email` varchar(40) NOT NULL default '', `RollID` varchar(32) NOT NULL default '', `PageID` tinyint(4) NOT NULL default 0, `UserKey` varchar(32) NOT NULL default '', `K_Type` tinyint(4) NOT NULL default 0, `KeyDate` datetime default NULL, `Personal` varchar(32) NOT NULL default '', `P_Type` tinyint(4) NOT NULL default 0, `KeyAsk` tinyint(4) NOT NULL default 0, `KeyChange` tinyint(4) default 0, `User` varchar(32) NOT NULL default '', `cookieKey` varchar(32) NOT NULL default '', `current` tinyint(4) NOT NULL default 0, `Mobile` varchar(14) NOT NULL default '0', `SMS_Count` varchar(14) NOT NULL default '0', `Proposed` varchar(32) NOT NULL default '', `Second` varchar(32) NOT NULL default '', PRIMARY KEY (`User`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; NOW with 3 rows also added as part of the table creation I I should simply do this. INSERT INTO SM3SusersX User '3e06fa3927cbdf4e9d93ba4541acce86'; 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 'User '3e06fa3927cbdf4e9d93ba4541acce86'' at line 1 Quote Link to comment https://forums.phpfreaks.com/topic/274749-auto-insert-with-missing-fields/ Share on other sites More sharing options...
Barand Posted February 21, 2013 Share Posted February 21, 2013 Have you considered reading the manual regarding INSERT syntax? INSERT INTO SM3SusersX (User) VALUES ( '3e06fa3927cbdf4e9d93ba4541acce86'); Quote Link to comment https://forums.phpfreaks.com/topic/274749-auto-insert-with-missing-fields/#findComment-1413753 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.