Updated to use mysqli
This commit is contained in:
parent
f683a7e43e
commit
63f5452107
@ -17,17 +17,10 @@
|
|||||||
$databaseUser = $GLOBALS['configuration']['user'];
|
$databaseUser = $GLOBALS['configuration']['user'];
|
||||||
$databasePassword = $GLOBALS['configuration']['pass'];
|
$databasePassword = $GLOBALS['configuration']['pass'];
|
||||||
$databasePort = $GLOBALS['configuration']['port'];
|
$databasePort = $GLOBALS['configuration']['port'];
|
||||||
$this->connection = mysql_connect ($serverName.":".$databasePort, $databaseUser, $databasePassword);
|
$this->connection = mysqli_connect ($serverName, $databaseUser, $databasePassword , $databaseName, $databasePort);
|
||||||
if ($this->connection)
|
if (!$this->connection)
|
||||||
{
|
{
|
||||||
if (!mysql_select_db ($databaseName))
|
throw new Exception('I cannot find the specified database "'.$databaseName.'". Please edit configuration.php.');
|
||||||
{
|
|
||||||
throw new Exception('I cannot find the specified database "'.$databaseName.'". Please edit configuration.php.');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
throw new Exception('I cannot connect to the database. Please edit configuration.php with your database configuration.');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -43,19 +36,19 @@
|
|||||||
|
|
||||||
public static function Reader($query, $connection)
|
public static function Reader($query, $connection)
|
||||||
{
|
{
|
||||||
$cursor = mysql_query($query, $connection);
|
$cursor = mysqli_query($connection, $query);
|
||||||
return $cursor;
|
return $cursor;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function Read($cursor)
|
public static function Read($cursor)
|
||||||
{
|
{
|
||||||
return mysql_fetch_assoc($cursor);
|
return mysqli_fetch_assoc($cursor);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function NonQuery($query, $connection)
|
public static function NonQuery($query, $connection)
|
||||||
{
|
{
|
||||||
mysql_query($query, $connection);
|
mysqli_query($connection, $query);
|
||||||
$result = mysql_affected_rows($connection);
|
$result = mysqli_affected_rows($connection);
|
||||||
if ($result == -1)
|
if ($result == -1)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
@ -66,14 +59,14 @@
|
|||||||
|
|
||||||
public static function Query($query, $connection)
|
public static function Query($query, $connection)
|
||||||
{
|
{
|
||||||
$result = mysql_query($query, $connection);
|
$result = mysqli_query($connection, $query);
|
||||||
return mysql_num_rows($result);
|
return mysqli_num_rows($result);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function InsertOrUpdate($query, $connection)
|
public static function InsertOrUpdate($query, $connection)
|
||||||
{
|
{
|
||||||
$result = mysql_query($query, $connection);
|
$result = mysqli_query($connection, $query);
|
||||||
return intval(mysql_insert_id($connection));
|
return intval(mysqli_insert_id($connection));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
Loading…
Reference in New Issue
Block a user