mysqlクエリは1行しか返さないため、foreachをif文に変換したいので、foreachの代わりにifを使いたい
$db = new db();
$db -> serverconnection();
$item = $_GET["name"];
$query = "SELECT c.firstname,c.phonenumber,c.address FROM `order` o,customerdetails c WHERE o.ordercode = '$item' AND c.sno=o.customerid";
$results = $db->selectQuery($query);
foreach ($results as $customerdetails)
{
$orderidDetail = $customerdetails['customerid'];
echo $customerdetails["firstname"];
echo $customerdetails["phonenumber"];
echo $customerdetails["address"];
}