bob_the _builder Posted April 13, 2007 Share Posted April 13, 2007 Hi, Im trying to grab a column of phone numbers from mysql table, send all the records across a hidden form field along with a message text area and reply field. once submitted grab all the records from the phone number column and format it to: $mobile = '12345,456788,566788,etc'; also grab the message post and reply post data Basically so I can send a the same message to all the mobiles. How could one acheive that? Thanks Link to comment https://forums.phpfreaks.com/topic/46841-arrays/ Share on other sites More sharing options...
bob_the _builder Posted April 13, 2007 Author Share Posted April 13, 2007 thats no explained well I grab all the records from a field: $sql = mysql_query('SELECT mobile FROM list'); while ($row = mysql_fetch_array($sql)) { $mobile = $row['mobile']; } I want to get all the numbers from the mobile column into a variable like: $mobile = '3245678,87978956,2321332,656546546,etc'; How can I go about that? Thanks Link to comment https://forums.phpfreaks.com/topic/46841-arrays/#findComment-228303 Share on other sites More sharing options...
Barand Posted April 13, 2007 Share Posted April 13, 2007 try <?php $res = mysql_query("SELECT phone FROM mytable") or die (mysql_error()); $phones = array(); while ($row = mysql_fetch_row($res)) { $phones[] = $row[0]; } $phonelist = join (',', $phones); #... echo "<input type='hidden' name='phones' value='$phonelist' />"; ?> Link to comment https://forums.phpfreaks.com/topic/46841-arrays/#findComment-228306 Share on other sites More sharing options...
bob_the _builder Posted April 13, 2007 Author Share Posted April 13, 2007 Ahh, Perfect thanks! Link to comment https://forums.phpfreaks.com/topic/46841-arrays/#findComment-228308 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.