Blogger Information
Blog 48
fans 0
comment 0
visits 36787
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
数据库的链接和数据的增删改查-2018.08.29
雨天的博客
Original
693 people have browsed it

实例

<?php
/**
 * 数据库的链接
 */
$host = '127.0.0.1';
$username = 'root';
$password = 'root';
$dbname   = 'stu';
$charset  = 'utf8';
$mysqli = new mysqli($host,$username,$password,$dbname);
if($mysqli->connect_errno)
{
    die('数据库连接失败'.$mysqli->connect_errno.$mysqli->connect_error);
}
echo '连接成功';
$mysqli->set_charset($charset);
echo '<h2>数据库的增删改查:</h2>';
echo '<h3>添加数据:insert into 表名 (字段名) values (字段值);</h3>';
echo '<h3>更新数据:update 表名 set 字段名=字段值 where 字段名=字段值;</h3>';
echo '<h3>删除数据:delete from 表名 where (条件);</h3>';
echo '<h3>查询数据:select * from 表名 where(条件);</h3>';
echo '<h2>什么类,什么是对象?</h2>';
echo '<p>类是对象的模板,对象是类的实例化;<br>类就好比是汽车,汽车颜色大小、汽车轮胎、代步就是类的属性和方法,不同品类的汽车就是对象。</p>';

运行实例 »

点击 "运行实例" 按钮查看在线实例


Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post