phpretard Posted October 29, 2010 Share Posted October 29, 2010 I need to some how pull comma separated images $data[23] from this $data array and then put them into there own array so I can insert them into separate rows in a database. This is the provided array: $data[0] => VIN $data[1] => StockNumber ...(all the other number here) $data[23] => Image_URLs (comma seperated) $data[24] => Equipment // I need something like this (obviously doesn't work?!@#) $delimiter = ","; $img = explode($delimiter, $data[23]); foreach($img as $pic){ $sqlPic = "insert into class_prodimages (pid image rank) values('".$LastId['id']."', '$pic', '".rand(1,20)."')"; } Any help here? Link to comment https://forums.phpfreaks.com/topic/217253-take-comma-seperated-values-from-one-array-and-put-them-in-a-new-array/ Share on other sites More sharing options...
mikecampbell Posted October 29, 2010 Share Posted October 29, 2010 Where you have insert into class_prodimages (pid image rank) .... that should be insert into class_prodimages (pid, image, rank) .... Link to comment https://forums.phpfreaks.com/topic/217253-take-comma-seperated-values-from-one-array-and-put-them-in-a-new-array/#findComment-1128209 Share on other sites More sharing options...
Yucky Posted October 30, 2010 Share Posted October 30, 2010 $new = explode(",", $data[23]); Link to comment https://forums.phpfreaks.com/topic/217253-take-comma-seperated-values-from-one-array-and-put-them-in-a-new-array/#findComment-1128215 Share on other sites More sharing options...
phpretard Posted October 30, 2010 Author Share Posted October 30, 2010 That was easy...Thanks!!! Link to comment https://forums.phpfreaks.com/topic/217253-take-comma-seperated-values-from-one-array-and-put-them-in-a-new-array/#findComment-1128336 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.