// Cache it and remember as last SQL query
$GLOBALS[__FUNCTION__][$sqlString] = $sqlStringModified;
- $GLOBALS['last_sql'] = $sqlStringModified;
+ $GLOBALS['last_sql'] = $sqlStringModified;
//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Stored cache: ' . $sqlStringModified);
} else {
//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Cache used: ' . $sqlString);
// SQL string escaping
function SQL_QUERY_ESC ($sqlString, $data, $F, $L, $run = true, $strip = true, $secure = true) {
// Link is there?
- if ((!SQL_IS_LINK_UP()) || (!is_array($data))) return false;
+ if ((!SQL_IS_LINK_UP()) || (!is_array($data))) {
+ // Link is down or data is not an array
+ /* DEBUG: */ logDebugMessage($F, $L, 'SQL_IS_LINK_UP()=' . intval(SQL_IS_LINK_UP()) . ',data[]=' . gettype($data) . ',sqlString=' . $sqlString . ': ABORTING!');
+ return false;
+ } // END - if
+
+ // Init array for escaped data with SQL string
+ $dataSecured = array(
+ '__sql_string' => $sqlString
+ );
// Escape all data
- $dataSecured['__sql_string'] = $sqlString;
foreach ($data as $key => $value) {
$dataSecured[$key] = SQL_ESCAPE($value, $secure, $strip);
} // END - foreach
// Get column information
$result = SQL_QUERY_ESC("SHOW COLUMNS FROM `%s` LIKE '%s'",
- array($tableName, $columnName), __FUNCTION__, __LINE__);
+ array(
+ $tableName,
+ $columnName
+ ), __FUNCTION__, __LINE__);
// Determine it
$GLOBALS[__FUNCTION__][$tableName][$columnName] = (!SQL_HASZERONUMS($result));