You only need this once (it also occurs later). Choose which one you want to keep. You'll also need to select the database, or edit the SQL statements to qualify table names.
Variables are not expanded in single quotes. Change them to double quotes.Quote:
function getCheapestHandset($make, $handset, $dbConnection) {
    $statement = 'SELECT handsetid, handset, gift, tariff, xnet, offpeak, texts FROM $table'
When accessing an array element during variable expansion, the expression must be surrounded by braces:Quote:
echo("$cheapestHandset['handsetid']")
  "{$cheapestHandset['handsetid']}"
Mike

