ich kenne mich in html relativ gut aus, aber nicht in PHP und muß einen xtcommerce 3.04-Shop auf mysqli umstellen, weil der Provider in Zukunft PHP 5.2 nicht mehr unterstützt und PHP 5.5 und höher ganz offensichtlich mysqli verlangt. Einfach alle mysql in mysqli ändern bringt aber die Fehlermeldung:
Verbindung erfolgreich:
Warning: mysqli_query() expects parameter 1 to be mysqli, null given in C:\xampp\htdocs\inc\xtc_db_query.inc.php on line 31
Warning: mysqli_errno() expects exactly 1 parameter, 0 given in C:\xampp\htdocs\inc\xtc_db_query.inc.php on line 31
Warning: mysqli_error() expects exactly 1 parameter, 0 given in C:\xampp\htdocs\inc\xtc_db_query.inc.php on line 31
-
Hier der Code von xtc_db_connect.inc.php
und hier von xtc_db_query.inc.php
was ist falsch?
Verbindung erfolgreich:
Warning: mysqli_query() expects parameter 1 to be mysqli, null given in C:\xampp\htdocs\inc\xtc_db_query.inc.php on line 31
Warning: mysqli_errno() expects exactly 1 parameter, 0 given in C:\xampp\htdocs\inc\xtc_db_query.inc.php on line 31
Warning: mysqli_error() expects exactly 1 parameter, 0 given in C:\xampp\htdocs\inc\xtc_db_query.inc.php on line 31
-
Hier der Code von xtc_db_connect.inc.php
PHP:
// include(DIR_WS_CLASSES.'/adodb/adodb.inc.php');
function xtc_db_connect($server = DB_SERVER, $username = DB_SERVER_USERNAME, $password = DB_SERVER_PASSWORD, $database = DB_DATABASE, $link = 'db_link') {
global $$link;
if (USE_PCONNECT == 'true') {
$$link = mysqli_pconnect($server, $username, $password, $database);
} else {
$$link = mysqli_connect($server, $username, $password, $database);
}
if ($$link) // mysqli_select_db($database)
{
echo 'Verbindung erfolgreich: ';
}
else
{
die ('keine Verbindung möglich: ' . mysqli_error());
}
return $$link;
}
PHP:
// include needed functions
include_once(DIR_FS_INC . 'xtc_db_error.inc.php');
$link = '$db_link';
function xtc_db_query()
{
global $$link;
//echo $query.'<br>';
if (STORE_DB_TRANSACTIONS == 'true') {
error_log('QUERY ' . $query . "\n", 3, STORE_PAGE_PARSE_TIME_LOG);
}
// $queryStartTime = array_sum(explode(" ",microtime()));
$result = mysqli_query($query, $$link) or xtc_db_error($query, mysqli_errno(), mysqli_error());
// $queryEndTime = array_sum(explode(" ",microtime()));
// $processTime = $queryEndTime - $queryStartTime;
// echo 'time: '.$processTime.' Query: '.$query.'<br>';
if (STORE_DB_TRANSACTIONS == 'true') {
$result_error = mysqli_error();
error_log('RESULT ' . $result . ' ' . $result_error . "\n", 3, STORE_PAGE_PARSE_TIME_LOG);
}
return $result;
}