本文整理匯總了PHP中db_connect::set_var方法的典型用法代碼示例。如果您正苦於以下問題:PHP db_connect::set_var方法的具體用法?PHP db_connect::set_var怎麽用?PHP db_connect::set_var使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類db_connect
的用法示例。
在下文中一共展示了db_connect::set_var方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: ping_db
}
//connect to database
function connect()
{
$this->connect = mysql_connect($this->server, $this->user, $this->pass);
if (!$this->connect) {
die("connection can not be established");
}
$db_select = mysql_select_db($this->database, $this->connect);
if (!$db_select) {
die("Database selection failed : " . mysql_error());
}
}
//ping to see whether the database has gone offline or not
private function ping_db()
{
}
//sanitize query to prevent sql-injection
function sanitize_query($query)
{
}
function close()
{
if (isset($this->connection)) {
mysql_close($this->connection);
}
}
}
$val = new db_connect();
$val->set_var($server, $user, $pass, $database);
$val->connect();