I have to get all the phone numbers of students from database and store in string variable with a comma in between them. I have tried the following but failed.
This is my code below :
$toNumbersCsv="";
$this->db->select("std_cellNo");
$this->db->from("student");
$queryforPhone = $this->db->get();
//Attempt 1
// while ($row = mysql_fetch_assoc($queryforPhone)) {
// $toNumbersCsv .= $row['std_cellNo'].',';
// }
//Attempt 2
foreach($queryforPhone as $qfp){
$toNumbersCsv .= $qfp.',';
}