wrathican Posted July 21, 2008 Share Posted July 21, 2008 i have two arrays that look like this: $name1[0][value] $name2[0][value2] typical [key][value] right? now what i need to do is use the values of both arrays in a mysql query. how do i loop through the arrays using the values in the query? so the query would look something like this: update table set col='$name1 value' where col='$name2 value' i hope that makes sense. thanks Link to comment https://forums.phpfreaks.com/topic/115900-solved-looping-through-arrays/ Share on other sites More sharing options...
trq Posted July 21, 2008 Share Posted July 21, 2008 Assuming they are both the same size.... for ($i=0; $i < count($name1); $i++) { $sql = "UPDATE TABLE SET col='{$name1[$i]}' WHERE col='{$name2[$i]}'"; } Link to comment https://forums.phpfreaks.com/topic/115900-solved-looping-through-arrays/#findComment-595952 Share on other sites More sharing options...
wrathican Posted July 22, 2008 Author Share Posted July 22, 2008 thanks alot! Link to comment https://forums.phpfreaks.com/topic/115900-solved-looping-through-arrays/#findComment-596312 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.