[英]how to add value this MAX number
This is my SQL
query. 这是我的SQL
查询。
$max_Number = DBGet(DBQuery("SELECT MAX(student_id) FROM students"));
When I print as array in PHP
. 当我在PHP
打印为数组时。 This array appear like this. 这个数组看起来像这样。 print_r($max_Number);
Array ( [1] => Array ( [MAX(STUDENT_ID)] => 4436 ) )
I want add 1 for the 4436
this value in php. 我想在PHP中为4436
这个值添加1。 how to do that.please help me 怎么做。请帮助我
Add 1 in a query: 在查询中添加1:
SELECT MAX(student_id) + 1 as `max` FROM students
Though I don't know why you need to increment student_id
, but if your case is to add new item with the next id - you're doing it wrong . 虽然我不知道为什么为什么需要增加student_id
,但是如果你的情况是用下一个id添加新项目 -你做错了 。 Instead - set student_id
as AUTOINCREMENT . 而是将student_id
设置为AUTOINCREMENT 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.