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!!! Link to comment https://forums.phpfreaks.com/topic/19506-get-last-row-with-content-in-spesific-column-and-insert-data-into-holes/ 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) Link to comment https://forums.phpfreaks.com/topic/19506-get-last-row-with-content-in-spesific-column-and-insert-data-into-holes/#findComment-84888 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] Link to comment https://forums.phpfreaks.com/topic/19506-get-last-row-with-content-in-spesific-column-and-insert-data-into-holes/#findComment-84899 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. Link to comment https://forums.phpfreaks.com/topic/19506-get-last-row-with-content-in-spesific-column-and-insert-data-into-holes/#findComment-84908 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.