0
ごめんなさい、PHPに関することはあまり知らないので、あるサーバから別のサーバにウェブサイトを移行する必要があります。 mysql_pconnect():MySQLの拡張機能が廃止され、 が削除されるサーバーは、私は、サイトを実行し、ウェブサイトの移行後、私はMySQLのエラーを受け取りました。廃止されました:mysql_pconnect():
の代わりにmysqliまたはPDOを使用してください非推奨を取得し、新しいサーバーやデータベースへのファイルの上に移動した後、OSやPHP の古いバージョンを持っていました将来は: /var/www/classes/dbcon.class.php on line 45
このファイルのコードはここにあります。私はいくつかの行を変更しようとしましたが、代わりにMySqliを使ってみましたが、うまく動作していないようです。
<?php
class dbCon
{
//
// private variables
//
var $_hostname_Con;
var $_database_Con;
var $_username_Con;
var $_password_Con;
var $_Con;
var $_result;
var $_hasData;
var $_lastQuery;
var $_row;
var $_rowCount;
//
// methods (private)
//
//
// methods (public)
//
// constructor
function dbCon()
{
$this->_hostname_Con = "localhost";
$this->_database_Con = "street";
$this->_username_Con = "rt";
$this->_password_Con = "mwL";
//*
$this->_database_Con = "cranes_cms";
$this->_username_Con = "t";
$this->_password_Con = "mob";
//*/
$this->_Con = mysql_pconnect ($this->_hostname_Con, $this->_username_Con, $this->_password_Con) or trigger_error(mysql_error(),E_USER_ERROR);
mysql_select_db($this->_database_Con) or die('Could not select database');
}
function freeResult()
{
mysql_free_result($this->_result);
}
function close()
{
mysql_close($this->_Con);
}
function update($inQuery)
{
//reset row counter and data flag
$this->_rowCount = 0;
$this->_hasData = FALSE;
//do SQL
$this->_lastQuery = $inQuery;
mysql_query($this->_lastQuery,$this->_Con) or die('Query failed: ' . mysql_error());
}
function select($inQuery)
{
//reset row counter and data flag
$this->_rowCount = 0;
$this->_hasData = FALSE;
//do SQL
$this->_lastQuery = $inQuery;
$this->_result = mysql_query($this->_lastQuery,$this->_Con) or die('Query failed: ' . mysql_error());
//set has data flag
if (mysql_num_rows($this->_result))
{$this->_rowCount = mysql_num_rows($this->_result);}
else
{$this->_rowCount = 0; }
if ($this->_rowCount > 0)
{$this->_hasData = TRUE;}
else
{$this->_hasData = FALSE;}
}
function getData()
{
if ($this->_hasData)
{
if ($this->_row = mysql_fetch_array($this->_result, MYSQL_ASSOC))
{
return $this->_row;
}
else
{
return FALSE;
}
}
else
{
return FALSE;
}
}
function getRowCount()
{
return $this->_rowCount;
}
function hasData()
{
return $this->_hasData;
}
// end
}
?>
これは他の人のコードであり、これを修正する場所がわかりません。誰でもできます
[非推奨:mysqlの\の_pconnect():]の可能複製(https://stackoverflow.com/q/22834458/6521116) –
のmysql _ *()がdeprecated.so使用であるmysqliの_ *() –
として私はPHPに関してはあまり知らないと言って、mysql_pconnectラインをmysqliに置き換えようとしましたが、それは単純ではないようです – MikeAsp