+ 1
PHP Warning: mysqli_real_escape_string() expects parameter 1 to be mysqli, null given in
<?php session_start(); ?> <?php require_once('Connections/config.php'); ?> <?php if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { if (PHP_VERSION < 6) { $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; } $theValue = function_exists("mysqli_real_escape_string") ? mysqli_real_escape_string($connection, $theValue) : mysqli_escape_string($connection, $theValue); switch ($theType) {
3 Antworten
+ 4
Diagnostic / troubleshooting questions:
Is the mysqli... test not supposed to run?
Use an "else" construct to keep it from running if PHP_VERSION is >= 6
...Or is it the null value?
Is require_once succeeding?
What's in your server logs related to that file (many things could be wrong here, from security access controls to a case-sensitive OS)?
If the file is including okay, are the variables present / properly initialized?
+ 1
The error is on this line
$theValue = function_exists("mysqli_real_escape_string") ? mysqli_real_escape_string($connection, $theValue) : mysqli_escape_string($connection, $theValue);
0
<?php session_start(); ?>
<?php require_once('Connections/config.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}
$theValue = function_exists("mysqli_real_escape_string") ? mysqli_real_escape_string($connection_vote, $theValue) : mysqli_escape_string($connection_vote, $theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
$colname_rstrack = "-1";
if (isset($_SESSION['trackid'])) {
$colname_rstrack = $_SESSION['trackid'];
}
mysqli_select_db($connection, $spider);