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=n-molot-vremeni
Resource [125] Каталог карт
Referer
User Agent CCBot/2.0 (https://commoncrawl.org/faq/)
IP 54.158.199.217
Current time 2018-09-23 00:18:56

Benchmarks
MySQL 0.0207 s (10 Requests)
PHP 0.0445 s
Total 0.0652 s
Memory 3.776252746582 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('n-molot-vremeni', string $var2, '')
includes/catalog.php on line 586
mysqli_real_escape_string($var1, 'n-molot-vremeni')
includes/catalog.php on line 370