php调试出错,显示Fatal error: Call to undefined function mysql_connect() in
求大神帮助错误码:Fatalerror:Calltoundefinedfunctionmysql_connect()inE:\kechengsheji\AppServ\w...
求大神帮助
错误码:Fatal error: Call to undefined function mysql_connect() inE:\kechengsheji\AppServ\www\com\db.php on line 16
错误代码:
<?php
class DataAccess{
// $conn存储数据库连接字符串
public $link;
// 数据查询的结果集
var $res;
function getLink()
{
return $this->link;
}
function connect()
{
$this->link = mysql_connect('localhost', 'root', '111');---------------------------------------这里----------------------------
if (!$this->link) {
die(' Could not connect: ' . mysql_error());
}
mysql_select_db('job', $this->link) or die ('Cannot use job : ' . mysql_error());
//echo 'Connected successfully';
return $this->link;
}
function close()
{
// 释放结果集
if(!empty($this->res))
mysql_free_result($this->res);
// 关闭连接
if($this->link)
mysql_close($this->link);
}
function getRowNum()
{
return mysql_num_rows($this->res);
}
/*数据查询函数*/
function &query($sql)
{
mysql_query("set names 'gbk'");
$this->res = mysql_query($sql) or die('数据库查询错误: ' . mysql_error());
return $this->res;
}
//插入删除修改操作
function &perform($sql)
{
mysql_query("set names 'gbk'");
$this->res = mysql_query($sql) or die('数据库查询错误: ' . mysql_error());
if($this->res)
return true;
return false;
}
}
?> 展开
错误码:Fatal error: Call to undefined function mysql_connect() inE:\kechengsheji\AppServ\www\com\db.php on line 16
错误代码:
<?php
class DataAccess{
// $conn存储数据库连接字符串
public $link;
// 数据查询的结果集
var $res;
function getLink()
{
return $this->link;
}
function connect()
{
$this->link = mysql_connect('localhost', 'root', '111');---------------------------------------这里----------------------------
if (!$this->link) {
die(' Could not connect: ' . mysql_error());
}
mysql_select_db('job', $this->link) or die ('Cannot use job : ' . mysql_error());
//echo 'Connected successfully';
return $this->link;
}
function close()
{
// 释放结果集
if(!empty($this->res))
mysql_free_result($this->res);
// 关闭连接
if($this->link)
mysql_close($this->link);
}
function getRowNum()
{
return mysql_num_rows($this->res);
}
/*数据查询函数*/
function &query($sql)
{
mysql_query("set names 'gbk'");
$this->res = mysql_query($sql) or die('数据库查询错误: ' . mysql_error());
return $this->res;
}
//插入删除修改操作
function &perform($sql)
{
mysql_query("set names 'gbk'");
$this->res = mysql_query($sql) or die('数据库查询错误: ' . mysql_error());
if($this->res)
return true;
return false;
}
}
?> 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询