Notice: Undefined offset: 0 in D:\phpStudy\www\web\htdocs\class\sql.php on line 46
Notice:Undefinedoffset:0inD:\phpStudy\www\web\htdocs\class\sql.phponline46sql.php46行代...
Notice: Undefined offset: 0 in D:\phpStudy\www\web\htdocs\class\sql.php on line 46
sql.php46行代码是下面最后一行代码,return $data[0]; 在线等,分数可追加
<?php class sql
{
public $config =array
(
'host' => 'localhost',
'user' => 'root',
'pwd' => 'sa',
'dbname' => 'hdm0820416_db',
'charset' => 'utf8'
);
public $query;
public $cache;
public function __construct() {
$config = $this->config;
$conn2=mysql_connect($config['host'],$config['user'],$config['pwd'],1,131072) or die("Could not connect: ".mysql_error());
$db= mysql_select_db($config['dbname'],$conn2) or die("Could not select database");;
mysql_query("SET NAMES ".$config['charset']);
$this->cache = new Cache();
}
/**
* 执行sql语句
* @param unknown $sql
* @param unknown $tableName
* @param string $update
* @return resource
*/
public function query($sql,$tableName,$update=FALSE) {
if ($update==true){
//删除缓存
$this->cache->delSql($tableName);
}
$this->query=mysql_query($sql) or exit ($sql);
return $this->query;
}
/**
* 获得一条
* @param unknown $tableName
* @param unknown $column
* @param unknown $where
* @return Ambigous <>
*/
public function onedata($tableName,$column=" * ",$where=""){
$data= $this->datalist ($tableName,$column,$where,1);
return $data[0];
}
?> 展开
sql.php46行代码是下面最后一行代码,return $data[0]; 在线等,分数可追加
<?php class sql
{
public $config =array
(
'host' => 'localhost',
'user' => 'root',
'pwd' => 'sa',
'dbname' => 'hdm0820416_db',
'charset' => 'utf8'
);
public $query;
public $cache;
public function __construct() {
$config = $this->config;
$conn2=mysql_connect($config['host'],$config['user'],$config['pwd'],1,131072) or die("Could not connect: ".mysql_error());
$db= mysql_select_db($config['dbname'],$conn2) or die("Could not select database");;
mysql_query("SET NAMES ".$config['charset']);
$this->cache = new Cache();
}
/**
* 执行sql语句
* @param unknown $sql
* @param unknown $tableName
* @param string $update
* @return resource
*/
public function query($sql,$tableName,$update=FALSE) {
if ($update==true){
//删除缓存
$this->cache->delSql($tableName);
}
$this->query=mysql_query($sql) or exit ($sql);
return $this->query;
}
/**
* 获得一条
* @param unknown $tableName
* @param unknown $column
* @param unknown $where
* @return Ambigous <>
*/
public function onedata($tableName,$column=" * ",$where=""){
$data= $this->datalist ($tableName,$column,$where,1);
return $data[0];
}
?> 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询