I'm pretty new to programming/coding/whatever you want to call it! Currently, I'm working on my first database project. In short, I submit a string (in my case a username) through a html form. It gets stored into a 3 column table:
|ID - USER - LAST UPDATE|
| 1 - test - 2012/02/18 |
ID is primary key, user is the username, last update is the date at which time the certain username got added.
I got all of this working, however I want to make my life a bit easier so that I can add multiple usernames at the same time. The string of usernames that I want to process looks like this:
username1 - username2 - username3 - ...
Each username is seperated by a '-' . I think it's easy to put all of these usernames in an array using explode().
Now I got a few questions:
1) How do I put these array elements in seperate rows in my MySQL database?
2) Is it possible to make my form processing in such a way that it checks whether a username is already in the database, in which case only the DATE column has to be updated to the date of the last update. If the username is not in the database, a new row has to be created obviously.
I hope it's clear, if not I'll add some more info. Thanks in advance!