Why i cannot pass array to function parametter with two items? here is the function, but i get just the first parameter Username
function selectSQL(Array $item, $table) {
global $conn;
foreach ($item as $field) {
$sql = "SELECT `$field` FROM `$table`";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
while($row = $result->fetch_assoc()) {
return $row["$field"];
}
}
}
}
calling it like this:
$selectFields = Array("Username", "Email");
echo selectSQL($selectFields, "upstrey");