I want to select from a table, get all the values and put them in an array, return the function, and call it in another file, and loop through the array whiles i call another function and supply it with the array values. Thanks
<?php
function getusers()
{
//db parameters here
mysql_connect($dbhost, $dbuser, $dbpass) or die("MySQL Error: " . mysql_error());
mysql_select_db($dbname) or die("MySQL Error: " . mysql_error());
$query = "SELECT user_name FROM userinfo";
$result = mysql_query($query);
while($row = mysql_fetch_array($result, MYSQL_ASSOC))
{
return $final[] = $row['user_name'];
}
mysql_Close ($conn);
}
?>
getusers() returns an array and I call it in another file
include('usernames.php');
getusers();
while!(end of [$final] array)
{
getTax($final[]);
}
function getTax($final)
{
//statement here
}
And in other file: