〇〇三章 php操作Mysql汇总

释放双眼,带上耳机,听听看~!

查询最大值
$sql= “select * from tb_shucai where youxiaoqi=(select max(youxiaoqi) from tb_shucai) “;
$query=mysql_query($sql);
$arr = mysql_fetch_array($query);
//创建一个数据库表
$sql = “create table if not exists test_mysql(
id int primary key auto_increment,
name varchar(32) comment ‘名称’,
key idx_no(no))”;


$sql = “insert into tb_shucai(leibie, name,danwei,price1,youxiaoqi) values(‘”.$data[0].”‘,'”.$data[1].”‘,'”.$data[2].”‘,'”.$data[4].”‘,'”.$data[8].”‘)”;


$sql = “delete from test_mysql where no = 2008”;


$sql = “update test_mysql set name = ‘yyyyyy’ where no = 2009”;


$sql = “select id,no,name from test_mysql”;
$ret = mysql_query($sql, $link);
if ($ret === false) {
die(“Select Failed: ” . mysql_error($link));
} else {
echo “Select Succeed<br />”;
while ($row = mysql_fetch_assoc($ret)) {
echo “{$row[‘id’]} {$row[‘no’]} {$row[‘name’]}<br />”;
}
}

【转自慕课】https://www.imooc.com

PHP

php.ini文件详解

2022-3-3 7:28:40

PHP

laravel 路由基本知识

2022-3-3 7:30:58

搜索