xiongwei89

//连接数据库

$conn=@mysql_connect("localhost","root","") or die ("连接错误"); //连接数据库
mysql_select_db("newdb",$conn);              //选择数据库
mysql_set_charset ("utf8")               //设置字符集
mysql_query($sql,$conn);              //执行sql语句

while ($row mysql_fetch_object($result)) {    //遍历数据
    echo 
$row->user_id;
    echo 
$row->fullname;
}

mysql_close($conn);                  //关闭数据库
?>

//数据操作语句

数据库读写分离

读出数据$dbs

写入数据$dbm

 

$dbm->query("INSERT INTO `list`(`id`,`name`,`age`)  VALUES(NULL,\'1\',\'2\')" );  //插入数据库

$dbm->query("update kahao set sure=\'否\'");                      //更改数据库

$dbm->query("delete from list where uid=2147483647")                //删除数据库

$dbs->query("select *  from list ");                           //查询数据库

 

分类:

技术点:

相关文章:

  • 2021-11-13
  • 2021-04-13
  • 2021-04-09
猜你喜欢
  • 2022-01-02
  • 2021-12-04
  • 2022-01-02
  • 2021-12-03
  • 2021-08-14
  • 2021-09-27
  • 2021-11-08
相关资源
相似解决方案