kwdelre Posted July 2, 2010 Share Posted July 2, 2010 Hey everyone I have a quick question. For my website I currently have one table in my MySQL. Information from customers gets inputted there automatically from script that a web developer did for me. I am needing to add a column (when in browse view) to make manual notes about certain accounts. If I do this will it screw anything up? I was thinking it shouldn't since that field would never be called for by the website but I am very hesitant to do anything. If this is not an option can you explain a way in which I could just make notes on certain rows (customer info) Thanks everyone! Quote Link to comment https://forums.phpfreaks.com/topic/206472-adding-a-field/ Share on other sites More sharing options...
fenway Posted July 2, 2010 Share Posted July 2, 2010 If you're asking if adding new columns to a random table can hurt anything in code that you wrote, the answer is no Quote Link to comment https://forums.phpfreaks.com/topic/206472-adding-a-field/#findComment-1080111 Share on other sites More sharing options...
kwdelre Posted July 2, 2010 Author Share Posted July 2, 2010 Well it's not a random table per se. My thinking was that since there is no present php code that calls for it, but I was worried about the structure of it affecting the current interaction between my website and that table. Do you still think it won't affect it? Quote Link to comment https://forums.phpfreaks.com/topic/206472-adding-a-field/#findComment-1080141 Share on other sites More sharing options...
kwdelre Posted July 3, 2010 Author Share Posted July 3, 2010 Anyone else? Quote Link to comment https://forums.phpfreaks.com/topic/206472-adding-a-field/#findComment-1080566 Share on other sites More sharing options...
fenway Posted July 6, 2010 Share Posted July 6, 2010 You should be just fine -- don't worry,. Quote Link to comment https://forums.phpfreaks.com/topic/206472-adding-a-field/#findComment-1081857 Share on other sites More sharing options...
kwdelre Posted July 6, 2010 Author Share Posted July 6, 2010 Just to be sure, when I am adding this column I would choose "text" as the type? I just want to be able to manually enter information once the other data has already been entered. Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/206472-adding-a-field/#findComment-1082061 Share on other sites More sharing options...
fenway Posted July 8, 2010 Share Posted July 8, 2010 TEXT is not particuarly efficient -- probably a VARCHAR of appropriate length. Quote Link to comment https://forums.phpfreaks.com/topic/206472-adding-a-field/#findComment-1083064 Share on other sites More sharing options...
kwdelre Posted July 8, 2010 Author Share Posted July 8, 2010 Well I added the field and then went and tested the registration form that I was worried would be effected and sure enough I got an error saying something about the number of fields not matching up. So I'm back to square one. I just need a way to make notes on these accounts! Ahhhhhhh Quote Link to comment https://forums.phpfreaks.com/topic/206472-adding-a-field/#findComment-1083119 Share on other sites More sharing options...
fenway Posted July 8, 2010 Share Posted July 8, 2010 What kind of error? From what? Quote Link to comment https://forums.phpfreaks.com/topic/206472-adding-a-field/#findComment-1083160 Share on other sites More sharing options...
DavidAM Posted July 8, 2010 Share Posted July 8, 2010 The error probably stems from an INSERT statement like: INSERT INTO tablename VALUES (1, 'TestName', 'Something'); // Which would essentially be the same as INSERT (id, name, info) INTO tablename VALUES (1, 'TestName', 'Something'); If there are no fields named in the INSERT statement (first one above), the server wants a value for EVERY column that exists in the table. When you add a new column, there are suddenly more columns than values and the INSERT will fail. This is one reason that I ALWAYS name the columns that I am INSERTing into. If you don't and you need to change the table structure, you have to modify EVERY insert statement in the application instead of just the ones that will include the new column. You will have to find all of the INSERT statments and either add a column list (like the second example) or add a value for the new field (an empty string in this case). Of course, your browse page is not going to magically update this column (well, it might if the programmer considered the possibility) and is not going to magically display this column (again, unless the programmer considered the possibility). Of course, if the progammer HAD considered the possibility, then he would most likely have provided an INSERT that would work under the circumstances. What exactly are you trying to accomplish? An ares to type the notes on the screen so you can print them A blank spot to write in (after printing the current page) Add these notes to the database so you can retrieve them and see them later The amount of code changes depends on your answer to the above. It is highly unlikely that you can get the functionality you are looking for by simply changing the database. Quote Link to comment https://forums.phpfreaks.com/topic/206472-adding-a-field/#findComment-1083193 Share on other sites More sharing options...
kwdelre Posted July 9, 2010 Author Share Posted July 9, 2010 Thanks for the elaborate response. When a customer registers on my site the database collects name,phone,address,etc. I would like a column that is normally empty. There, I want to write quick notes about the account when it is not a "normal" registration. Currently I access my database through web.com's phpmyadmin. The table there is where I would like to view and write in the comments. I will check for the INSERT code later tonight. Does my description above help describe my intentions? Quote Link to comment https://forums.phpfreaks.com/topic/206472-adding-a-field/#findComment-1083334 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.