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 Quote Link to comment 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 Quote Link to comment 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' />"; ?> Quote Link to comment Share on other sites More sharing options...
bob_the _builder Posted April 13, 2007 Author Share Posted April 13, 2007 Ahh, Perfect thanks! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.