Hi how do i update a selected column with numbers ?
001
002
003
004
005
and so on
when i delete a row shall we say 003
i have then the numbers
001
002
004
005
thats not the problem
the problem is when i insert a new image
then i have the numbers
001
002
004
005
005
how can i update after delete
so that the numbers wil be 001, 002, 003, 004, 005, and so on
i have the folowwing code but it doesn't work proper.
$query = "SELECT nummer FROM narr_fotos_kostumball WHERE albumdescription='$album_descr'";
$result = mysql_query($query) or die(mysql_error());
while($row = mysql_fetch_array($result)){
$tafel = "00";
for ($i=$row['nummer']+1;$i<=$row['nummer']+1;$i++){
if($row['nummer']>='9'){
$tafel = "0";
}
if($row['nummer']>='99'){
$tafel = "";
}
mysql_query(" UPDATE narr_fotos_kostumball SET nummer=('$tafel$i') WHERE albumdescription='$album_descr'");
echo $row['nummer'];
echo "<br />";
} }
echo $row; i have put in to test
the output on this wil be
005, 005, 005, 005, 005 and so on depends how many rows there are.
thanks i advice John