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

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

.htaccess - Matching full URL in RewriteCond -