当前位置:   article > 正文

php mysql表的增删改查,PHP 之Mysql增删改查操作案例

php增删改查mysql实例

1:user表:

CREATE TABLE `user` (

`id` int(11) NOT NULL AUTO_INCREMENT,

`name` varchar(32) NOT NULL,

PRIMARY KEY (`id`)

) ENGINE=MyISAM DEFAULT CHARSET=utf8

2:mysqltools.php  (mysql工具类)

class MySqlTools{

private $host='127.0.0.1';

private $uname='root';

private $pwd='mysql';

private $dbname='test';

private $conn;

function __construct(){

$this->conn=mysql_connect($this->host,$this->uname,$this->pwd)

or die('mysql_connect error:'.mysql_error());

mysql_select_db($this->dbname)

or die('mysql_select_db error:'.mysql_error());

mysql_query("set names 'utf8'");

}

function exec_dql($sql){

$result&

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/小小林熬夜学编程/article/detail/464815
推荐阅读
相关标签
  

闽ICP备14008679号