ohdang888 Posted November 26, 2008 Share Posted November 26, 2008 i have a var like this: $_POST['ids'] = array('1', '12345', '25645'); and i want to split it and insert them in my databse...i had this code to do it: if(isset($_POST['ids'])){ foreach($ids as $value){ echo $value."<br>"; //mysql insert } } but i'm getting this error: Warning: Invalid argument supplied for foreach() in /home/public_html/links/invite.php on line 10 whats wrong? Thanks. Link to comment https://forums.phpfreaks.com/topic/134372-solved-how-to-split-array/ Share on other sites More sharing options...
flyhoney Posted November 26, 2008 Share Posted November 26, 2008 <?php $_POST['ids'] = array('1', '12345', '25645'); if (isset($_POST['ids'])) { foreach ($_POST['ids'] as $value) { echo $value."<br>"; //mysql insert } } ?> Link to comment https://forums.phpfreaks.com/topic/134372-solved-how-to-split-array/#findComment-699555 Share on other sites More sharing options...
ohdang888 Posted November 26, 2008 Author Share Posted November 26, 2008 ayyyy gosh it always has to be some simple mistake... thanks. Link to comment https://forums.phpfreaks.com/topic/134372-solved-how-to-split-array/#findComment-699560 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.