Oxymen Posted September 2, 2006 Share Posted September 2, 2006 Hi. I am making a mysql table where there is always a posibility that a cell is empty. i will try to illustrate:[table][tr][td]Firstname[/td][td]Lastname[/td][/tr][tr][td]Bob[/td][td]Larsen[/td][/tr][tr][td]Lyle[/td][td][/td][/tr][tr][td]Brian[/td][td]Holmes[/td][/tr][/table]I want my form to insert the next lastname that is submitted into row two as this is empty.The first and last names have no relationship as this is only a database of names, and I dontwant to make one table for firstnames and one table for second names. but still I dont wantto have holes in the table.I also need a way to get the last row of first and second name individualy, not just the last rowin the table, to hinder that empty rows are outputted later.Thanks a lot!!! Quote Link to comment Share on other sites More sharing options...
AndyB Posted September 2, 2006 Share Posted September 2, 2006 [quote]... but still I dont want to have holes in the table.[/quote]Why not? Who cares? It's easier to code around datafields containing nothing than try looking to fill gaps in a database (which is one step away from trashing a perfectly good database) Quote Link to comment Share on other sites More sharing options...
Barand Posted September 2, 2006 Share Posted September 2, 2006 Wouldn't it then be better then to have table defined as[pre]names--------id int not null auto_increment primary key,nametype char, // F or L (first or last name)name varchar(20)[/pre] You then have no holes and get the last lastname added with[code]SELECT name FROM namesWHERE nametype = 'L'ORDER BY id DESCLIMIT 1[/code] Quote Link to comment Share on other sites More sharing options...
Oxymen Posted September 2, 2006 Author Share Posted September 2, 2006 Thanks Barand, I didnt think of that sollution, that will work. Quote Link to comment 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.