I have this function:
function selectValue($test) {
$connection = dbConnect(HOST, USERNAME, PASSWORD, DATABASE);
$query = "SELECT * FROM table where value = '$test'";
$results = @mysql_query($query, $connection);
$value = mysql_fetch_assoc($results);
}
selectValue('abcde');
echo $value['something'];
This results in $value becoming an array. I would like to access this array from outside of the function. I tried to do this using the last line of code above (ie. echo…) but this doesn’t work. How should I do this?
1 Answer