Quantcast
Channel: VBForums
Viewing all articles
Browse latest Browse all 15042

auto incremental registration number not working php codeigniter framwork

$
0
0
I followed youtube tutorial but my codes are not working
I want to auto increase registration number
this is what I tried

in model code
PHP Code:

public function auto() {
    
$regNO "reg";
    
$query 'select max(registerNO) as regNO_auto from student';
    
$data $this->db->query($query)->row_array();
    
$max_regNO $data['regNO_auto'];
    
$max_regNO2 = (int)substr($max_regNO,7,3);
    
$regNOcount $max_regNO2+1;
    
$regNO_auto $regNO."-".sprintf('%07s'$regNOcount);
    return 
$regNO_auto;


in view

PHP Code:

<?php
  $regNO 
$this->members_m->auto();
  echo 
form_input([
   
'name'=> 'registerNO',
   
'class'=>'form-control',
   
'value'=>set_value('registerNO'$regNO),
   
'readonly'=>'true']);
 
?>

this is what i want to get SPPS-0000001 and it should be auto increamental
what am doing wrong
is there a better way to get the same result than this

Viewing all articles
Browse latest Browse all 15042

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>