TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 03-18-2009, 08:59 AM   #1 (permalink)
is cute and cuddly
 
delayedinsanity's Avatar
 
Join Date: Mar 2008
Location: Vegas, Baby
Posts: 963
Thanks: 31
delayedinsanity is on a distinguished road
Default User defined fields?

I was just curious how the rest of you would go about tackling this situation.

Instead of creating a hardcoded profile table for the members of my current projects web site, I'd like to leave it dynamic. Easy to change, without modifying the code or SQL tables. So off the top of my head, I figured two tables; one holds the field information (fid, name, description) such as 'full name', 'location' etc. The other would hold the data (uid, fid, content).

Within seconds of this idea though I realized how disorderly this could wind up as I wouldn't be able to set the field type of 'content' in the second table. It would have to be a data type that could hold any amount of information, of string, character, or integer values. A 'type' enum column would have to be added to the first table, and error checking to validate the various types would have to be built into the script.

Not a difficult task, but I'm willing to bet there's a better way of doing this. Any suggestions?
delayedinsanity is offline  
Reply With Quote
Old 03-21-2009, 08:38 PM   #2 (permalink)
The Contributor
 
Join Date: Apr 2005
Location: Kent, UK
Posts: 54
Thanks: 0
Dr John is on a distinguished road
Default

apparently this is a common thing to invent and it never works properly as it is impossible to implement.
This talks about it http://www.sitepoint.com/forums/showthread.php?t=606735
The articles mentioned by rudy / r937 show problems with this approach.
(I just changed from one forum to the other and read the same question in each!)
__________________
www.kidneydialysis.org.uk
Dr John is offline  
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Defining your World: All About Constants Wildhoney General 15 01-29-2013 12:32 PM
Easy to Modify Login Script with Hierarchical User Permissions and XML Account File Wildhoney Script Giveaway 4 05-04-2011 06:11 AM
Required fields in a contact form code_junkie General 4 12-16-2008 03:34 PM
User profile page h0ly lag General 2 05-08-2008 08:53 PM
User defined function with 'return' statement -- not working Dave Absolute Beginners 3 04-15-2008 07:15 PM


All times are GMT. The time now is 02:36 AM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design