Jump to content

Auto insert with missing fields


otuatail

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/274749-auto-insert-with-missing-fields/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.