How to update this array?


Posted on 16th Feb 2014 07:03 pm by admin

I am saving a string that looks this: username1, username2, username3...
into a single cell in a database table.
I am doing this so that when I retrieve that string using normal methods, I can turn it into an array.

However, my question is: I will need to update that cell and add user names to it. and then save it back to the database.
I don't have any example code as I haven't started because I am not sure where to start.

This is what I was thinking.

It will start out with one username "username1".
That is what the original value will be. I then need to pull that info out (easy) and populate an array

Code: $original = 'username1';
$userArray = array($original);
I then need to turn around and add 'username2' to $userArray. and add it to the DB so it is formatted as username1, username2, username3..

No comments posted yet

Your Answer:

Login to answer
253 Like 8 Dislike
Previous forums Next forums
Other forums

Session problem?!?
Hello All! I am very new to the php world but I am working on fixing things that a previous programm

Print 'a' to 'z' via for loop
A very simple problem..
How Can I print a to z NOT a to y ?
It is a part of a code where
<

Changing color in GD via variable?
Hey guys, I'm new here. x)

I'm very much a noob when it comes to PHP, but I'm trying to learn

single page with referrer to show correct page
I have a simple website with a couple of different pages. I would like to be able to in a div tag w

please, need help coding this voting for your favorite car polling system.
hi, my code needs a lot of work, but i want to be able to let users vote on their favorite car, upda

What am I missing here? Help!
Hello all!. I can't seem to get this working right. Well - it renders right, but something is goin

Form submissing with PHP and JQuery/Ajax
I have searched everywhere, but cannot find a solution for this... I have worked all day trying to g

Dynamically set AccordianPane Header
I have an accordian on my master page. I'd like to be able to dynamically change the header on diff

PHP Code reffering to database, doing something wrong.. pls help
Well i am quite new with PHP
and for school we have to make a PHP script which reffers to a Data

Javascript using window.location seems to lose state
Not sure what forum so let me know if I'm in the wrong place. I have a main window with a ajax grid

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash