设置或增加字母数字表字段ID [英] set or increment an alphanumeric table field id
本文介绍了设置或增加字母数字表字段ID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在id下方的代码将id vlaue递增现有最大值的1,例如A00001并将新值作为A00002回显,但else条件不起作用
需要帮助...谢谢.
My code below id incrementing the id vlaue by 1 of the existing max value e.g. A00001 and echo new value as A00002, but the else condition is not working
Need help... Thanks.
<?php
//connect to database
include ('config.inc');
$result=mysql_query("Select max(aid) as lastaid from assets";);
if (false !== $row = mysql_fetch_assoc($result)) {
$max_id = $row["lastaid"];
$max_id++;
$new_id = $max_id;
}
else
{
$max_id = "A00001";
}
echo "$max_id";
?>
推荐答案
result = mysql_query( 从资产中选择max(aid)作为lastaid";); 如果(false!==
result=mysql_query("Select max(aid) as lastaid from assets";); if (false !==
row = mysql_fetch_assoc(
row = mysql_fetch_assoc(
结果)){
result)) {
这篇关于设置或增加字母数字表字段ID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文