继续浏览精彩内容
慕课网APP
程序员的梦工厂
打开
继续
感谢您的支持,我会继续努力的
赞赏金额会直接到老师账户
将二维码发送给自己后长按识别
微信支付
支付宝支付

〇〇三章 php操作Mysql汇总

手记佰篇
关注TA
已关注
手记 60
粉丝 58
获赞 272

查询最大值
$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 />";
}
}

打开App,阅读手记
1人推荐
发表评论
随时随地看视频慕课网APP