Trying to get property of non-object

« MODX Parse Error »

Error : mysqli_real_escape_string() expects parameter 1 to be mysqli, resource given
Error information
ErrorType[num] WARNING[2]
File /var/www/public_html/includes/catalog.php
Line 370
Source $query = "SELECT * FROM cardscatalog WHERE cardid = '" . mysqli_real_escape_string( $modx->db->conn, $cardid )."'";
Current Snippet TestCatalog

Basic info
REQUEST_URI http://berserk-online.com/spisok_kart.html?c=b-beholder
Resource [125] Каталог карт
Referer
User Agent CCBot/2.0 (https://commoncrawl.org/faq/)
IP 54.82.10.219
Current time 2018-12-15 05:48:12

Benchmarks
MySQL 0.0206 s (10 Requests)
PHP 0.0493 s
Total 0.0699 s
Memory 3.7762985229492 mb

Backtrace
DocumentParser->executeParser()
index.php on line 128
DocumentParser->prepareResponse()
manager/includes/document.parser.class.inc.php on line 2141
DocumentParser->parseDocumentSource(string $var1)
manager/includes/document.parser.class.inc.php on line 2218
DocumentParser->evalSnippets(string $var1)
manager/includes/document.parser.class.inc.php on line 2003
DocumentParser->_get_snip_result('TestCatalog')
manager/includes/document.parser.class.inc.php on line 1408
DocumentParser->evalSnippet(string $var1, array $var2)
manager/includes/document.parser.class.inc.php on line 1466
eval()
manager/includes/document.parser.class.inc.php on line 1360
getCatalog()
manager/includes/document.parser.class.inc.php(1360) : eval()'d code on line 2
getCatalog_noAJAX()
includes/catalog.php on line 830
getCatalogImage('b-beholder', string $var2, '')
includes/catalog.php on line 586
mysqli_real_escape_string($var1, 'b-beholder')
includes/catalog.php on line 370