TheFilmGod Posted September 8, 2007 Share Posted September 8, 2007 What is wrong with this query? $insert = "INSERT INTO attendance (date, 1, 2, 3, 4, 5) VALUES ('$date', '$id_1', '$id_2', '$id_3', '$id_4', '$id_5')"; mysql_query($insert) or die("Error: ". mysql_error(). " with query ". $insert); ? ??? Help greatly appreciated. Link to comment https://forums.phpfreaks.com/topic/68491-help/ Share on other sites More sharing options...
Barand Posted September 8, 2007 Share Posted September 8, 2007 illegal column names 1,2,3,4,5 Link to comment https://forums.phpfreaks.com/topic/68491-help/#findComment-344306 Share on other sites More sharing options...
TheFilmGod Posted September 9, 2007 Author Share Posted September 9, 2007 illegal column names 1,2,3,4,5 Please tell me you are lying! Can I do something like a1 a2 a3 a4 a5? Link to comment https://forums.phpfreaks.com/topic/68491-help/#findComment-344532 Share on other sites More sharing options...
TheFilmGod Posted September 9, 2007 Author Share Posted September 9, 2007 alright so you are right. I was thinking something was funky with the fieldnames. Well, the way I created the table is that I need 41 fieldnames. Each for 41 members. Now I don't want to use their names for it because the names might change overtime. So I have another table for the names. I thought I could easily link them by the id of their name to the # id in this table. But this isn't the case, since number like 1, 2, 3, can't be fieldnames. What I can do to name 41 fieldnames without using numbers? a, b, c,... ab, ac, ad,...? Link to comment https://forums.phpfreaks.com/topic/68491-help/#findComment-344551 Share on other sites More sharing options...
Fadion Posted September 9, 2007 Share Posted September 9, 2007 U have a column for each member? Dont know how's your script, but it looks like an awful application and database design. Why cant u create a row for each member?! Link to comment https://forums.phpfreaks.com/topic/68491-help/#findComment-344603 Share on other sites More sharing options...
TheFilmGod Posted September 9, 2007 Author Share Posted September 9, 2007 Actaully I considered that and that would be an even poorer design. This is suppose to act as an attendance table. So I have a column for each member and each row would be a meeting day. It is much easier and logically smarter to have the rows the meeting days and not the column because all you do is insert into attendace (meeting, a1, a2, a3).. values ($date,...). Then when a user checks if he was present or unexcused for a meeting all I do is search his column for the respective answers. Link to comment https://forums.phpfreaks.com/topic/68491-help/#findComment-344819 Share on other sites More sharing options...
Barand Posted September 9, 2007 Share Posted September 9, 2007 Ok, so you have a record with the ids of 41 people. What query are you going to use to "Give names of all members present on a given date in alphabetical order" Link to comment https://forums.phpfreaks.com/topic/68491-help/#findComment-344839 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.