Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
#1 2005-04-16 01:38:00
- domfucssion
- Plugin Author
- Registered: 2004-10-23
- Posts: 39
plugin database access question
I am making an admin-plugin that allows editing of custom fields on the fly for each section in the write tab. It’s going well, but I am at the limit of my mysql knowledge…(the sets of custom fields are stored in a separate table)
I have an auto incrementing id number, but I am bulding an interface which allows creating AND deleting of the custom fields. If a field is deleted and the new one added, then there is a gap in the ids which buggers up my loops which create the fields.
I know how to delete the ids manually in the terminal and rebuild the list in numerical order, but that is no good here.
What I need is if a field is deleted, the next one added should get the next numeric id (like normal counting) NOT the id that auto increment wants to give it.
To make it more complex, if one had 5 custom fields already setup by the plugin, and then decided to delete #2, when the table of existing customs is displayed, in this instance a gap between #1 and #3 should be identifyable, eg. how can i check in my php loop if that id has infact been deleted. I cant have then renumber themselves back into a straight numeric sequence as once set, the custom field has to stay linked to that id.
I suppose if I work that out, I don’t have to worry about the first issue, but it would leave some confusing gaps and pump the custom_field number artificialy high.
confused? I am..
is this sort of thing even possible?
Offline
#2 2005-04-16 02:02:57
- Mary
- Sock Enthusiast
- Registered: 2004-06-27
- Posts: 6,236
Re: plugin database access question
Hmm, unique ids aren’t supposed to be played with for good reason. Perhaps you could show someone what you’ve got and can help you find a different way around it?
Offline
#3 2005-04-16 09:30:05
- domfucssion
- Plugin Author
- Registered: 2004-10-23
- Posts: 39
Re: plugin database access question
It’s allright, i’m gonna hack it a different way, without the Id involved in the loop..cheers, my post was a bit of a late night cry of confuscion, I am rolling again now, cheers
Offline
Re: plugin database access question
very happy to hear this plugin is being worked on
thanks :)
textpattern.org :: find and share Textpattern resources
docs.textpattern.io :: Textpattern user documentation
Offline
Pages: 1