Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 427e89c

Browse files
添加 php操作MYSQL 数据库之mysqli_query()
1 parent ecf7ce8 commit 427e89c

File tree

4 files changed

+140
-93
lines changed

4 files changed

+140
-93
lines changed

‎.idea/workspace.xml‎

Lines changed: 89 additions & 91 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎README.md‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,8 @@
3636

3737
## PHP加密技术
3838
> PHP加密函数
39-
* crypt()函数
40-
* md5()函数
39+
* crypt() 函数
40+
* md5() 函数
41+
* sha1() 函数
42+
43+
## PHP 操作 MySQL 数据库

‎php-mysql/conn.php‎

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<?php
2+
/**
3+
* Created by PhpStorm.
4+
* User: zq199
5+
* Date: 2016年10月30日
6+
* Time: 20:11
7+
*/
8+
//连接数据库
9+
$conn = mysqli_connect('localhost','root','');
10+
if($conn){
11+
echo '<p>数据库连接成功!';
12+
}
13+
$link = mysqli_select_db($conn,'test12') or die ('数据库访问错误'.mysqli_errno($conn));
14+
if($link){
15+
echo '<p>数据库选择成功!';
16+
}
17+
mysqli_query($conn,"set names utf8_general_ci");
18+
//插入数据
19+
$result1 = mysqli_query($conn,"insert into tb_user(user,pwd) VALUES ('Nike','nike123')");
20+
if($result1){
21+
echo '<p>插入数据成功!';
22+
}
23+
//修改数据
24+
$result2 = mysqli_query($conn," update tb_user set user='nike',pwd='change123' WHERE user = 'Nike'");
25+
if($result2){
26+
echo '<p>修改数据成功!';
27+
}
28+
//修改数据
29+
$result3 = mysqli_query($conn," delete from tb_user WHERE user = 'nike'");
30+
if($result3){
31+
echo '<p>删除数据成功!';
32+
}
33+
//查询数据
34+
$result4 = mysqli_query($conn," select * from tb_user");
35+
if($result4){
36+
echo "<p>查询数据成功!";
37+
}
38+
39+
mysqli_close($conn);

‎php-mysql/fetch_array.php‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?php
2+
/**
3+
* Created by PhpStorm.
4+
* User: zq199
5+
* Date: 2016年10月30日
6+
* Time: 20:39
7+
*/

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /