php get the max(accNumber) and then increment by 1 -
i'm trying highest number , increment 1. blank page, here code
$query = $pdo->prepare("select max(accnum) accounts"); $query->execute(); while($num = $query->fetchall()){ if($num[1] == null){ $accnumber = "100001"; }else{ $accnumber = $num[1]++; } echo $accnumber; }
what doing wrong here. thanks
$query = $pdo->prepare("select max(accnum) accounts"); $query->execute(); while($num = $query->fetchall()){ if($num[0] == null){ $accnumber = "100001"; }else{ $accnumber = $num[0]++; } echo $accnumber; }
Comments
Post a Comment