need help Updating table info from any array

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
DougieC
Forum Newbie
Posts: 18
Joined: Fri Jul 25, 2003 1:49 pm

need help Updating table info from any array

Post by DougieC »

I am getting the values from a check box and go through a loop to get the values ' 1 ',' 2 ',' 3 '.
what I am wanting to do is replace the existing values with the new ones
i bring in with the array. so for example I had

AgencyID_____ServiceID
1 ____________1
1 ____________ 2
I would Like it to change to

AgencyID_____ServiceID
1 ____________1
1 ___________ 2
1 ____________3
here is my sql query

Code: Select all

<?php

UPDATE AgencyServices ags 

INNER JOIN AgencyServices ON (ag.AgencyID = ags.AgencyID) 
INNER JOIN Services s ON (ags.ServiceID = s.ServiceID) 
INNER JOIN UserLogin ul ON (ag.AgencyID = ul.AgencyID) 

SET ags.ServiceID IN (' 1 ',' 2 ',' 3 ' ) // i think thats my problem

WHERE ul.UserName ='blah'
AND ul.Password ='blah'

?>
Any help would be great!!! Thanks
Post Reply