惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

aimingoo的专栏
aimingoo的专栏
宝玉的分享
宝玉的分享
J
Java Code Geeks
Martin Fowler
Martin Fowler
博客园 - Franky
I
InfoQ
Stack Overflow Blog
Stack Overflow Blog
Blog — PlanetScale
Blog — PlanetScale
S
SegmentFault 最新的问题
B
Blog
The Cloudflare Blog
F
Fortinet All Blogs
量子位
腾讯CDC
博客园 - 司徒正美
D
Docker
大猫的无限游戏
大猫的无限游戏
Microsoft Azure Blog
Microsoft Azure Blog
T
The Blog of Author Tim Ferriss
V
Visual Studio Blog
IT之家
IT之家
Last Week in AI
Last Week in AI
D
DataBreaches.Net
小众软件
小众软件

博客园 - 小默同学

C语言文件操作 makefile 文件的写法 tkinter教程 基本黑客技术 window下开机自启动.bat文件和后台启动.bat文件 django 用 uvicorn 部署 python 声音去噪处理 免费文字转语音工具 折半查找python代码实现 c:\windows\temp\ccvjvr7w.o:problemfour.cpp:(.text+0x17): undefined reference to `std::basic_istream< - 小默同学 Android连接第三方模拟器 vscode下搭建springboot python jwt 一篇文章极速复习drf知识点 LCD1602代码记录 外部排序 {&quot;detail&quot;:[{&quot;loc&quot;:[&quot;body&quot;],&quot;msg&quot;:&quot;field required&quot;,&quot;type&quot;:&quot;value_error.missing&quot;}]} 防止win10系统把破解软件当成病毒自动删除keil的破解软件 ERROR 1366 (HY000): Incorrect string value: '\xC4\xE3\xBA\xC3' for column 'p - 小默同学
basis of PHP DBMA about mysql
小默同学 · 2023-11-30 · via 博客园 - 小默同学
  1. php 连接数据库
header("Content-type:text/html; charset=utf8");
$servername = "localhost";
$username = "root";
$password = "root";
$dbTable = "dvwa";

$conn = mysqli_connect($servername, $username, $password, $dbTable);


if(!$conn)
    die("mysql连接失败:".mysqli_connect_error());

echo "mysql连接成功!";
  1. php 查询数据库
$result = mysqli_query($conn, "select * from Student;");  // 获得结果
$data = mysqli_fetch_array($result)                       // 以数组的方式取出数据
  1. php 实现增删改
$result = mysqli_query($conn, $sql);
$affected_row = mysqli_affected_rows($conn);    // 影响的数据条数,整数
if($affected_row) {
	echo 'success';
} else {
	echo 'error';
}