I'm using the following code to print my array:
//SQL Query
$query = "SELECT wp_arf_entry_values.entry_value, wp_arf_entry_values.id FROM wp_arf_entry_values WHERE entry_id=1";
//Execute the SQL query and return records
$result = mysql_query($query);
while($row = mysql_fetch_assoc($result)){
$results[] = $row;
}
//Print array in human readable form
print("<pre>".print_r($results,true)."</pre>");
This is the output:
Array
(
[0] => Array
(
[entry_value] => John
[id] => 1
)
[1] => Array
(
[entry_value] => Doe
[id] => 2
)
[2] => Array
(
[entry_value] => 19
[id] => 3
)
[3] => Array
(
[entry_value] => Male
[id] => 4
)
)
I'm having a hard time to figure out how I can extract the array's values into variables, like this (not actual code, just an example):
$fName = 'entry_value' that has ID = 1
$lName = 'entry_value' that has ID = 2
$age = 'entry_value' that has ID = 3
$genre = 'entry_value' that has ID = 4
I've researched here for the past hour but I can't find an answer that helps me. What's a feasible way to do this?