Код: Выделить всё
function fetchInvoice($invoiceID, $DBname, $DBuser, $DBpass) {
$servername = CConfig::$DB_HOST;
try {
$conn = new PDO("mysql:host=$servername;dbname=$DBname", $DBuser, $DBpass);
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$stmt = $conn->prepare(" --some query--");
$stmt->bindParam(1, $invoiceID, PDO::PARAM_INT);
$stmt->execute();
$res = $stmt->fetch(PDO::FETCH_LAZY);
return $res;
} catch (Exception $e) {
writeLog($e->getMessage() . "\n","main");
}
}
Подробнее здесь: https://stackoverflow.com/questions/791 ... turn-array