mysql - PHP to return "simple" array using mysqlli -


i trying list or emails in "simple" array mysql database, can use them in phpmailer emailing. getting multidimensional array, rather array:

$query = "select distinct `emailaddress` `emails` `jobid` = 1"; $result = $conn->query($query);      if (!$result) {   printf("query failed: %s\n", $mysqli->error);   exit; }       while($row = $result->fetch_row()) {   $rows[]=$row; } $result->close(); $conn->close(); var_dump($rows); // return array(2) { [0]=> array(1) { [0]=> string(24) "abc@abc.com" } [1]=> array(1) { [0]=> string(17) "hello@gmail.com" } }  //this how array should $myv = array("abc@abc.com","hello@gmail.com"); var_dump($myv); //this array need have: array(2) { [0]=> string(11) "abc@abc.com" [1]=> string(11) "hello@g.com" } 

many thanks!

do fetch_assoc

while($row = $result->fetch_assoc()) {   $rows[]=$row['emailaddress']; } 

Comments

Popular posts from this blog

javascript - oscilloscope of speaker input stops rendering after a few seconds -

javascript - gulp-nodemon - nodejs restart after file change - Error: listen EADDRINUSE events.js:85 -

Fatal Python error: Py_Initialize: unable to load the file system codec. ImportError: No module named 'encodings' -