Page 1 of 1

How to insert data into existing row

Posted: Sat Oct 23, 2010 4:44 am
by infomamun
Hi there,
Suppose I have a mysql table like this

Table:multiple
================================
id | date | colA | colB | colC | colD |
================================

Now, I have two cron job setted. cronA.php will have to insert data like this way:
INSERT into MULTIPLE (date, colA, colB) Values(23-09-10,2305,2306)

while a second cron job will execute the cronB.php at later, I want to add data somethin like this:
INSERT into MULTIPLE(colC,colD)Values(2407,208) WHERE date="23-09-10"

i.e I want to add values for colA & ColB at one time and values for colC and colD at later time for the same row (suppose, row id is 10 in both cases)

is it possible? If yes,then please mention the php syntax for this type of job.

Regards.

Re: How to insert data into existing row

Posted: Sat Oct 23, 2010 5:52 am
by s.dot
You will want to use an UPDATE query

Re: How to insert data into existing row

Posted: Sat Oct 30, 2010 3:18 am
by suleman
you need update query instead of insert query

Re: How to insert data into existing row

Posted: Mon Nov 01, 2010 2:25 am
by infomamun
I have a confusion. I think I have to insert at first then the update by second cron job. Because without insert how id will be autoincremented? And if id will not be incremented then how can I update fields, because I have to run query like this:

update colB where id=3 , is not it?


so I have to insert at first like this:
insert date value 1-11-2010
then
update colB where id=2/3 or whatever?

Any alternative way?