jacomus Posted April 7, 2008 Share Posted April 7, 2008 This is probably something quite basic with a quick answer, but what I want to do is alter a table to ignore blank entries. I assume the syntax is similar to this statement below, which ignores duplicate entries (abc being the name of the table): ALTER IGNORE TABLE abc -> ADD PRIMARY KEY (abc); Link to comment https://forums.phpfreaks.com/topic/99954-quick-question-altering-a-table-to-ignore-blank-entries/ Share on other sites More sharing options...
fenway Posted April 7, 2008 Share Posted April 7, 2008 "ignore blank entires'/ Link to comment https://forums.phpfreaks.com/topic/99954-quick-question-altering-a-table-to-ignore-blank-entries/#findComment-511217 Share on other sites More sharing options...
jacomus Posted April 9, 2008 Author Share Posted April 9, 2008 I tried fitting this all over the place into the syntax and I can't seem to get it to work. Sorry, I am fairly new to this program. Link to comment https://forums.phpfreaks.com/topic/99954-quick-question-altering-a-table-to-ignore-blank-entries/#findComment-513236 Share on other sites More sharing options...
gluck Posted April 9, 2008 Share Posted April 9, 2008 Heres is how you do it: ALTER TABLE T ADD F NOT NULL , ADD PRIMARY KEY (F); What do you mean by ignore blank entries? Why do you want to add a primary key? Link to comment https://forums.phpfreaks.com/topic/99954-quick-question-altering-a-table-to-ignore-blank-entries/#findComment-513258 Share on other sites More sharing options...
jacomus Posted April 9, 2008 Author Share Posted April 9, 2008 Thank you. Also, I mean when a blank entry is present in a text box, that it will not be entered into the database. Link to comment https://forums.phpfreaks.com/topic/99954-quick-question-altering-a-table-to-ignore-blank-entries/#findComment-513269 Share on other sites More sharing options...
gluck Posted April 9, 2008 Share Posted April 9, 2008 Thank you. Also, I mean when a blank entry is present in a text box, that it will not be entered into the database. You'll have to check it on the php side because the moment you enter a duplicate it will generate a mysql error Link to comment https://forums.phpfreaks.com/topic/99954-quick-question-altering-a-table-to-ignore-blank-entries/#findComment-513273 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.