Indexed array question

How do I get my query results into an indexed array?

$myarray = $db->get_results("SELECT page FROM t1
WHERE item = '$book'");

I would like to then do array_search withing that array to see what array key value corresponsd to my given variable. Something like this:

if (($key = array_search($needle, $haystack)) !== false) {
$thisval = $haystack[$key];
}