PDA

View Full Version : AJAX Link Text -> Textbox then Insert into MySQL


epheterson
12-06-2009, 03:33 PM
I have this idea for a clever way to insert Titles into a database for a list of entries which would otherwise be only numbers.

That is for something unnamed, it says 'Nameless' where the title should show. When the user clicks 'Nameless,' it turns into a textbox saying 'Enter Title then [Enter]' or something like that and when he hits Enter, it turns back into a text link, but with the correct title, and behind the scenes that record was added to a MySQL database.

My question to you: Where do I start and what framework (if any) would be good to use? I know of JQuery and CakePHP (The site is written in PHP anyway). This would be my first AJAX implementation so I'm treading slowly.

Thanks

gusblake
12-06-2009, 05:19 PM
A framework would be unnecessary in my opinion.

What's the structure of the database, and what is it used for? Or are you just doing this for fun?

epheterson
12-06-2009, 08:18 PM
Great if a framework is unnecessary! I just haven't used much of them before and thought it could make the job easier.

I believe this might almost do the trick: http://www.phpclasses.org/browse/package/3217.html

I'm doing it as kind of my 20% time at work (not at Google). It's a MySQL database where I'm listing items which are, for both convenience and necessity, used throughout the code as a number. For each of these numbers, though, I can apply a Human-Readable title which makes the data much easier to understand.

Pictures speak louder than words:
http://bayimg.com/image/nagidaaca.jpg
Sorry about the quality

I don't have all of these names in the database, some show up as "Nameless." Regardless, I'd like to be able to double-click any of the titles above and change the record associated with that number in the database, or create one if none exists.