Thursday, September 26, 2013

Database records not placing exactly continiously

Database records not placing exactly continiously

I have this code, My primary in my database is counter.
<input class="textbox1" tabIndex="8" maxLength="49" size="30"
name="n_counter" value='
<?php
$result = mysql_query("SELECT * FROM procurement WHERE counter != ' '");
while ( $row = mysql_fetch_array( $result ) ) {
$value = $row['counter'];
}
$i = "0";
while ( $i <= $value ) {
$i++;
}
$value2 = strlen( $i );
if ( $value2 == 1 ) {
echo "00000" . $i;
} else if ( $value2 == 2 ) {
echo "0000" . $i;
} else if ( $value2 == 3 ) {
echo "000" . $i;
} else if ( $value2 == 4) {
echo "00" . $i;
} else if ( $value2 == 5 ) {
echo "0" . $i;
} else {
echo $i;
}
?>'>
The looping statement works perfectly, but my problem is when I deleted
records from database.

When I deleted 000001 records and add another records, that records goes
next to 000000, what I want is 000010 should next to 000009. In my other
project that works perfectly. What is the problem?

No comments:

Post a Comment