Hi ModX Users
I`ve been using ModX for some time now, however im not expierienced in coding and tried to solve it myself but without result. I wanted to have something like name-day snippet so I wrote one and it works preety well however on some pages im using Easy2Gallery and then I got plenty errors from ModX Pharser.
I would be happy if anyone can point what might be causing those errors.
My snippet uses simple mysql database where with dates in format mm-dd with list of names.
<?php
$SERWER_DB="host";
$UZYTKOWNIK="db_username";
$HASLO="db_password";
$BLAD=" Sorry, an error occurred during the execution of this command";
$WIADOMOSC="The command completed successfully";
$BAZA="db_database";
$TABELA="db_imieniny";
$polacz = mysql_connect($SERWER_DB, $UZYTKOWNIK, $HASLO) or die($BLAD);
$d_m= date("m");
$d_d= date("d");
$d_szukane=$d_m.'-'.$d_d;
mysql_select_db($BAZA);
mysql_query('SET NAMES utf8');
$wynik = mysql_query("SELECT * FROM $TABELA WHERE `data`='$d_szukane'") or die($BLAD);
$row= mysql_fetch_array($wynik);
if(mysql_num_rows($wynik) == 0) {
echo "Today, no one has a name day? : (";
} else {
echo '<strong>Today names-day is: </strong>'. $row['imieniny'];
}
//mysql_free_result($wynik);
mysql_close($polacz);
?>
So as I said before evrything works fine separetly but after executing two snippets i got plenty of errors:
« MODX Parse Error »
MODX encountered the following error while attempting to parse the requested resource:
« PHP Parse Error »
PHP error debug
Error : mysql_real_escape_string() [function.mysql-real-escape-string]: Access denied for user 'UNKNOWN_USER'@'localhost' (using password: NO)
ErrorType[num] : WARNING[2]
File : /mysite/assets/modules/easy2/includes/models/e2g.public.class.php
Line : 225
Source : $string = mysql_real_escape_string($string);
Basic info
REQUEST_URI : /index.php?id=25
Resource : [25]test
Current Snippet : easy2
Referer :
User Agent : Mozilla/5.0 (Windows NT 6.1; WOW64; rv:27.0) Gecko/20100101 Firefox/27.0
IP : 83.11.107.196
Benchmarks
MySQL : 0.0036 s (10 Requests)
PHP : 0.0529 s
Total : 0.0565 s
Memory : 2.4170150756836 mb
Backtrace
1 DocumentParser->executeParser()
index.php on line 140
2 DocumentParser->prepareResponse()
manager/includes/document.parser.class.inc.php on line 1568
3 DocumentParser->outputContent()
manager/includes/document.parser.class.inc.php on line 1673
4 DocumentParser->parseDocumentSource()
manager/includes/document.parser.class.inc.php on line 582
5 DocumentParser->evalSnippets()
manager/includes/document.parser.class.inc.php on line 1450
6 DocumentParser->_get_snip_result()
manager/includes/document.parser.class.inc.php on line 1061
7 DocumentParser->evalSnippet()
manager/includes/document.parser.class.inc.php on line 1147
8 eval()
manager/includes/document.parser.class.inc.php on line 1005
9 include()
manager/includes/document.parser.class.inc.php(1005) : eval()'d code on line 2
10 E2gSnippet->__construct()
assets/modules/easy2/snippet.easy2gallery.php on line 94
11 E2gPub->sanitizedString()
assets/modules/easy2/includes/models/e2g.snippet.class.php on line 66
12 mysql_real_escape_string()
assets/modules/easy2/includes/models/e2g.public.class.php on line 225
I would be gratefull if anyone can help me with that!
Cheers Chris