Jump to content

Recommended Posts

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!

Link to comment
https://forums.phpfreaks.com/topic/206472-adding-a-field/
Share on other sites

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

Link to comment
https://forums.phpfreaks.com/topic/206472-adding-a-field/#findComment-1083119
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/206472-adding-a-field/#findComment-1083193
Share on other sites

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?

Link to comment
https://forums.phpfreaks.com/topic/206472-adding-a-field/#findComment-1083334
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.