猿问

mysql选取数据库最大值,然后加1写入数据库

 $kejian=mysql_connect("localhost","root","root");
$result=mysql_select_db("ultrax",$kejian);
$sql="SELECT MAX (id) from dizhi";
$rows2=mysql_query($sql);
$_SESSION['id']=$rows2;
$_SESSION['id']+=1;
mysql_query("INSERT INTO dizhi (wenjiandizhi,id) VALUES ('http://localhost/Thehome/upfile/uploads/{$fileInfo['name']}','{$_SESSION['id']}')");
mysql_close($kejian);

慕仔8661472
浏览 2091回答 1
1回答
随时随地看视频慕课网APP
我要回答