vladj Posted November 18, 2008 Share Posted November 18, 2008 Hi, I need to update speciffic dates from a table yyyy-mm-dd, for records with id from the array ('101','107','111'). I have defined the array. I execute the mysql query and obtain the needed dates as an array, and then I need to use those dates to update other records, that have no dates yet, but have ids from the previous array. Sorry I'm a newbie, don't know to advance further. $id_s=array('113','114'); $sql="select distinct date,id from calendar where date>'".$year."-11-14' and dayofweek(date)=1 and month(date)=11"; $result=mysql_query($sql); while ($rows=mysql_fetch_array($result)) { echo $rows['datea']; } This gives me the array of dates. The values form the first array, are actually present in the table, but with no date. So then I need to $update = "update calendar set date=" . $rows['date'] ."' where id=$id_s"; That is I need to update the table record with the first id in the array with the first date obtain from the previous query. The second id, with the second date...and so on. I have no clue how to do this. Thanks Link to comment https://forums.phpfreaks.com/topic/133182-update-multiple-rows-for-records-of-certain-values-from-an-array/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.