Jump to content

Is it possible..


Unknown98

Recommended Posts

Is is possible, to have a field "copy" data from another field in the same table? Say, I have "user_name" and "username" fields. If data is inserted into "user_name", can I set "username" to automatically copy the data from the "user_name" field? It would have the same effect as inserting data into both fields, but with only having to insert data into one of them.

Link to comment
Share on other sites

Because I am working with a content management system -- PHP Fusion -- and for some reason I can't add my custom field to the default SQL insert query when somebody registers. Apparently the field has to start with user_, and I didn't do that a year ago when I set up the database. When someone registers, they can choose their city via a drop-down box. For some reason, the way the CMS is built, I can't add their city to the database unless the DB field starts with user_. It would be a LOT of work to weed through all the pages and lines of code and change everywhere where it calls for the city, from just '$data['city']' to $data['user_city'].  Thus why I was wondering if I could create a new field, user_city, and insert their city into that when they register. Then, have the "city" field copy the user_city info, so I wouldn't have to look through thousands of lines of code and change a ton of variables.

 

If you know another way of doing this that's better, I'm all ears  :P I know it's not correct or proper, but at the time I wasn't aware the field had to start with the user_ prefix.

Link to comment
Share on other sites

maybe I'm going to ask the obvious but....

- did you ask about your problem in the PHP-Fusion Forum?

- did you read the PHP-Fusion Manual starting in pages 40 and up? prefix seems to be optional or anything.

 

replace across multiples files should no be a problem (almost a piece of cake if well controlled) using a good editor... and if everything fail.... then....

TRIGGER

http://dev.mysql.com/doc/refman/5.0/en/triggers.html

Link to comment
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.