Post Reply  Post Thread 

How to code dynamic database update.
Author Message
jignesh
Moderator

Moderators

Posts: 366
Group: Moderators
   
Cash: 307.00 Donate
How to code dynamic database update.

Hello,
i want to know how to update or add any field in database dynamically.
eg.
there is one user interface form in which 10 fields. now if we want to add one more field in that form than we need to add that in DB also.so what i want to know is.if i add that field in form it must add in to DB also.

i hope u understand my query, if u have any resources than plz post here.

thanks


Technical Information | Technical World | Seo Services india | BizComSoft
05-25-2007 08:13 PM
Send the author an email Send the author a private message Find all posts by this author Quote this message in a reply

Advertisements

This is an ad revenue sharing forum
Nameslot
Administrator

Administrators

Posts: 1,538
Group: Administrators
   
Cash: 500.50 Donate
RE: How to code dynamic database update.

I did thought like you in the beginning. One friend of mine also thought like you. But I can tell you that it can be achieved with Alter table query.

Which I wouldn't recommend.

If you can specify some more details then I can achieve the same thing without adding a new field in the table.

Thanks.


Nameslot.com | Do you have a question? shoot me a PM.
05-25-2007 08:31 PM
Send the author an email Send the author a private message Visit authors website Find all posts by this author Quote this message in a reply
jignesh
Moderator

Moderators

Posts: 366
Group: Moderators
   
Cash: 307.00 Donate
RE: How to code dynamic database update.

I know about alter table but i have one study project where i need implement that script.i will explain whole situation in details here a'ter requirement gathering of the dynamic database.


Technical Information | Technical World | Seo Services india | BizComSoft
05-26-2007 12:08 AM
Send the author an email Send the author a private message Find all posts by this author Quote this message in a reply
Nameslot
Administrator

Administrators

Posts: 1,538
Group: Administrators
   
Cash: 500.50 Donate
RE: How to code dynamic database update.

I have one basic idea right now which can be a base for the further developments. Do one thing make another table called dyn_table or something like that. Now you can create some columns like:
ID - Auto increment, primary key
Field - Varchar
Data - Varchar or text as per need
Mapping - Varchar

Now whenever a new feild is inserted just insert that new field data into this table.
ID will be auto incremented.
Field will be the field name [Ex: Phone number]
Data will be the data which user inputs.
Mapping this will contain the ID of the entry of the original table. Which would also be a unique one.

When fetching the data for a person you can fetch it regularly from the original table and just run one more query on the dyn_table which will fetch all the extra fields inserted for that particular person's row.

This will give it extra flexibility giving you a free hand to generate dynamic fields maybe 2 sometimes and maybe 1 at other time.

Thanks. :grin: BTW the above things are creations of an idle mind :grin: Like mine. So if you think it is confusing one then please don't hesitate to ask your questions.


Nameslot.com | Do you have a question? shoot me a PM.
05-26-2007 02:29 PM
Send the author an email Send the author a private message Visit authors website Find all posts by this author Quote this message in a reply
jignesh
Moderator

Moderators

Posts: 366
Group: Moderators
   
Cash: 307.00 Donate
RE: How to code dynamic database update.

i go through the reply and i understand what u mean to say. i have implemented those things before,and really work correctly for me.thanks for the idea i will ask u if find any difficulties.


Technical Information | Technical World | Seo Services india | BizComSoft
05-26-2007 04:06 PM
Send the author an email Send the author a private message Find all posts by this author Quote this message in a reply
jignesh
Moderator

Moderators

Posts: 366
Group: Moderators
   
Cash: 307.00 Donate
RE: How to code dynamic database update.

Now i m giving the exact requirement in that study project,
see there is one entity and it have around 10 attributes.now i want to add any more attrubute than in traditional fasion what we have to do is we need to update database manually.i want that when we add field in to that form it should automatically add that in DB also.
for exp.

one page is student.php

now in this page there is 10 attributes called name,age,student id etc...
so this form is to fill student information now if i want to add one more field called student class than i have to add <input type="" name="" value=""> for that field and i also add that field in DB.
so i want that when i add <input type="" name="" value=""> it should also added in to db. it should not like we need to add one new field by enter in \localhost\phpmyadmin and add one new field in to that table.

i think u can understand my doubt now.

thanks


Technical Information | Technical World | Seo Services india | BizComSoft
05-28-2007 06:02 PM
Send the author an email Send the author a private message Find all posts by this author Quote this message in a reply
Nameslot
Administrator

Administrators

Posts: 1,538
Group: Administrators
   
Cash: 500.50 Donate
RE: How to code dynamic database update.

Got it. As stated above the previous solution would solve the problems out.

If you have any doubts then please don't hesitate to ask. Thanks.


Nameslot.com | Do you have a question? shoot me a PM.
05-28-2007 10:17 PM
Send the author an email Send the author a private message Visit authors website Find all posts by this author Quote this message in a reply

Post Reply  Post Thread 


Similar Threads
Thread: Author Replies: Last Post
How to code a template? -Mahi- 2 05-25-2007 01:42 AM
php RSS to HTML code nick 2 03-09-2007 04:24 PM
PHP paypal IPN code nick 0 11-23-2006 12:08 AM

View a Printable Version | Send this Thread to a Friend | Subscribe to this Thread | Add Thread to Favorites
Rate This Thread:
Forum Jump: