Hi everyone, I have a script that takes the last number and adds 1 digit to it. The problem I have is with the format of the numbering, my number system is 0001 etc but when my script runs it just generates the number 2 and not 0002. Does anyone know to overcome this please?
my current code is:-
[php]<?php
include(’…/…/includes/mysqli_connect.php’);
if (mysqli_connect_errno($db)) {
trigger_error('Database connection failed: ’ . mysqli_connect_error(), E_USER_ERROR);
}
$client_proj_no = (“SELECT max(client_proj_no)+1 as client_proj_no FROM fms_tbl_projects WHERE client_id=’{$_SESSION[‘client_id_of_user’]}’”);
$result = mysqli_query($db, $client_proj_no) or trigger_error("Query Failed! SQL: $query - Error: ". mysqli_error($db), E_USER_ERROR);
if($result) {
while($row = mysqli_fetch_assoc($result)) {
echo "<input name='client_proj_no' class='form-control' value ='".$row['client_proj_no']."' readonly>" ;
}
}
?>[/php]
thanks in advance