I have initialize an array with keys IDs of something. How can I get all this keys as a list-stack-array for example, after of that initiaze ?
this is my code:
$sql = "SELECT id,name FROM Something WHERE id IN ( SELECT fk_Id FROM Something_Meta WHERE fk_pId=$data) ORDER BY name ASC";
if($stmt = $mysqli->prepare($sql))
{
$stmt->execute();
$stmt->bind_result($id,$name);
while ($stmt->fetch())
{
echo "<hr>";
$a_tmp_array[$id] = $name;
echo "<hr>";
}
}
print_r($a_tmp_array);
After of that I want something like this:
for (;;;)
$keyArray = key_from($a_tmp_array)
or
foreach (array_keys($a_tmp_array) as array_keys($a_tmp_array))
$keyArray[$i++] = array_keys($a_tmp_array);
the last one it throughs me a fatal error due to array_keys() function is a returning fuctions as foreach is going crazy :)
Also,
print_r($a_tmp_array); returns the following:
Array ( [2] => some1 [3] => some2 [4] => some99 [1] => etc [14] => foo )