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