From 9560bbe8687743627afdf25708fd161772e7f2bb Mon Sep 17 00:00:00 2001 From: Bochkarev Ivan Date: Sun, 15 May 2022 11:21:57 +0600 Subject: [PATCH] Fixing the example --- .../xpdo/class-reference/xpdo/xpdo.query.md | 11 +++++------ .../xpdo/class-reference/xpdo/xpdo.query.md | 11 +++++------ 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/en/extending-modx/xpdo/class-reference/xpdo/xpdo.query.md b/en/extending-modx/xpdo/class-reference/xpdo/xpdo.query.md index c348a3605..de8d08fe1 100644 --- a/en/extending-modx/xpdo/class-reference/xpdo/xpdo.query.md +++ b/en/extending-modx/xpdo/class-reference/xpdo/xpdo.query.md @@ -37,12 +37,11 @@ The SQL statement to prepare and execute. Data inside the query should be [prope ```php $result = $modx->query("SELECT * FROM modx_users WHERE id=1"); -if (!is_object($result)) { - return 'No result!'; -} -else { - $row = $result->fetch(PDO::FETCH_ASSOC); - return 'Result:' .print_r($row,true); +if(!$result->fetch(PDO::FETCH_ASSOC)) { + return 'No result!'; +} else { + $row = $result->fetch(PDO::FETCH_ASSOC); + return 'Result:' .print_r($row,true); } ``` diff --git a/ru/extending-modx/xpdo/class-reference/xpdo/xpdo.query.md b/ru/extending-modx/xpdo/class-reference/xpdo/xpdo.query.md index d3aa80a0b..b8e43a452 100644 --- a/ru/extending-modx/xpdo/class-reference/xpdo/xpdo.query.md +++ b/ru/extending-modx/xpdo/class-reference/xpdo/xpdo.query.md @@ -36,12 +36,11 @@ xPDOObject|false query (string $statement) ```php $result = $modx->query("SELECT * FROM modx_users WHERE id=1"); -if (!is_object($result)) { - return 'No result!'; -} -else { - $row = $result->fetch(PDO::FETCH_ASSOC); - return 'Result:' .print_r($row,true); +if(!$result->fetch(PDO::FETCH_ASSOC)) { + return 'No result!'; +} else { + $row = $result->fetch(PDO::FETCH_ASSOC); + return 'Result:' .print_r($row,true); } ```