'; echo 'ERROR : '.nl2br($this->error).''."\n"; if ($bool_die) { die(); } } /** * Static method to colorized SQL string * * @param string $sql_string * @return string */ public static function colorSQLstring($sql_string = '') { // list of mysql reserved words $reservedwords = array( "\bDATABASE\b", "\bTABLE\b", "\bAND\b", "\bOR\b", "\bSELECT\b", "\bINSERT\b", "\bUPDATE\b", "\bDELETE\b", "\bALTER\b", "\bFROM\b", "\bWHERE\b", "\bLIKE\b", "\bORDER BY\b", "\bLIMIT\b", "\bUSE\b", "\bDESCRIBE\b", "\bJOIN\b", "\bLEFT\b", "\bRIGHT\b", "\bINNER\b", "\b=\b", "\b!=\b", "\bON\b", "\bIN\b", "\bAS\b", "\bNULL\b", "\bNOT\b", "\bIS\b", "\bINTO\b"); // colorized the sql string $matches_str = array(); preg_match_all("/'[^']*'/i", $sql_string, $matches_str, PREG_SET_ORDER); if ($matches_str) { foreach ($matches_str as $sql_str) { $sql_string = preg_replace("/".$sql_str[0]."/i", ''.$sql_str[0].'', $sql_string); } } // colorized brackets $sql_string = str_replace(array('(',')'), array('(', ')'), $sql_string); // colorized the SQL reserved words foreach ($reservedwords as $words) { $sql_string = preg_replace("/$words/i", ''.$words.'', $sql_string); } // remove regex special chars $sql_string = str_replace(array('\b'), '', $sql_string); return $sql_string; } } ?>