欢迎访问 生活随笔!

生活随笔

当前位置: 首页 >

mysql类 php100_PHP100中,制作自己的PHP.MYSQL类中:Access denied for user ''@'localhost' (using password: NO)...

发布时间:2025/3/19 29 豆豆
生活随笔 收集整理的这篇文章主要介绍了 mysql类 php100_PHP100中,制作自己的PHP.MYSQL类中:Access denied for user ''@'localhost' (using password: NO)... 小编觉得挺不错的,现在分享给大家,帮大家做个参考.

具体代码如下:<?phpclasssu {private$host;private$root;private$pass;private$name;private$table;function__construct($host,$root,$pass,$table){$this->host=$host;$this->root=$...

具体代码如下:

class su{

private $host;

private $root;

private $pass;

private $name;

private $table;

function __construct($host,$root,$pass,$table){

$this->host=$host;

$this->root=$root;

$this->pass=$pass;

$this->table=$table;

}

function connect(){

$con=mysql_connect($this->host,$this->root,$this->pass) or die(mysql_error());

$sel=mysql_select_db($this->table,$con)or die(mysql_error());

$ch=mysql_query("set names 'gbk'");

}

function query($v){

return mysql_query($v) or die(mysql_error());

}

function insert($table,$name,$value){

$this->query("insert into $table ($name) value ($value)");

}

}

$p=new su('localhost','root','448824','susheguangli');

$p->insert("susheguangli","工号,姓名,性别,入职时间,入住宿舍,床位,户口,工资","6498,'高榆','男',new(),new(),3,'止州花东',2300");

?>

展开

与50位技术专家面对面20年技术见证,附赠技术全景图

总结

以上是生活随笔为你收集整理的mysql类 php100_PHP100中,制作自己的PHP.MYSQL类中:Access denied for user ''@'localhost' (using password: NO)...的全部内容,希望文章能够帮你解决所遇到的问题。

如果觉得生活随笔网站内容还不错,欢迎将生活随笔推荐给好友。