Adding numerous fields to a table and displaying in a form

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
PMacca_1987
Forum Newbie
Posts: 5
Joined: Sun Apr 04, 2010 10:27 am

Adding numerous fields to a table and displaying in a form

Post by PMacca_1987 »

Hi guys,

I'm having issues working out whether what I wish to do with my code is possible and how I would start to go about coding it.

The story is as follows..!

The intended use for the system is for a user (salesperson) to log in and add sales to their record.

To do this the user will be required to go into a settings section to select the attributes that they wish to store about their products. So rather than me telling the user what fields to store such as price and size, the user will select the names of these themselves and also the number of fields that they will use. :banghead:

Then I wish to display them in a form that the user can use to add details about their products.

I intend to create this using php and mysql but if any javascript is required then I guess I will have to use it.

Apologies if this seems vague but please let me know if you have any questions/solutions.

Paul
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: Adding numerous fields to a table and displaying in a fo

Post by Christopher »

Store each attribute individually in a separate table. Each record will have the user's ID, the product ID, the attribute, and the associated data.
(#10850)
PMacca_1987
Forum Newbie
Posts: 5
Joined: Sun Apr 04, 2010 10:27 am

Re: Adding numerous fields to a table and displaying in a fo

Post by PMacca_1987 »

Thanks very much for your reply, ill get to work on it now.
:D
User avatar
califdon
Jack of Zircons
Posts: 4484
Joined: Thu Nov 09, 2006 8:30 pm
Location: California, USA

Re: Adding numerous fields to a table and displaying in a fo

Post by califdon »

At the risk of misunderstanding what you are trying to do, I would suggest that you should give a lot of thought to whether you want to do this at all. Unless you intend to write an entire generalized database application (a monumental task), you will have a very crippled system, since you won't provide the users a decent user interface, query capabilities, reports, etc. If you just want to test your own programming skills, OK, but if this is a serious project, I would recommend that you explore some online database systems, some of which are free, up to some volume limit. One such site is http://infodome.com/.
PMacca_1987
Forum Newbie
Posts: 5
Joined: Sun Apr 04, 2010 10:27 am

Re: Adding numerous fields to a table and displaying in a fo

Post by PMacca_1987 »

OK, what would be the difference between using an online database in comparison to a mysql database if the application will be doing the same thing?

The idea of the system is to allow a customer to personalise their products before they add the data. I understand that this will likely cause reporting issues, will using an online database solve this?

Thanks
User avatar
califdon
Jack of Zircons
Posts: 4484
Joined: Thu Nov 09, 2006 8:30 pm
Location: California, USA

Re: Adding numerous fields to a table and displaying in a fo

Post by califdon »

Yes, that's the point. If you have looked at the site I referenced, or of others of similar nature, you should see that they provide the entire user interface, allowing users to design their own tables, their own forms, their own reports. You are not required to do ANY programming. I found that particular site to have a very advanced and intuitive user interface for designing and using a database (which is probably MySQL behind the scenes, anyway). Another feature is that you can designate other users to share a database with, so you could, for example, have a group of sales personnel (or agents, or whatever) who could have various permissions (to view reports, to enter data, to modify or add tables, forms, reports, etc.).

In other words, with a staff of programmers and years of work, they have already developed the system that you are asking how to develop.
Post Reply