No statements will be executed after return
you are returning inside whlie
while($row = mysql_fetch_array($query)){
return $row[name];// this is wrong
}
Change it to
$name = array();
while($row = mysql_fetch_array($query)){
$name[] = $row[name];// assign to array
}
return $name;// <--- return here.
Also switch to mysqli_*
or PDO
as mysql_*
is deprecated.
solved Datatable while not working [closed]