...

View Full Version : Weird Id ascending



Dat
02-27-2008, 07:19 AM
Look at thumbnail

I had the script arrange it by using MYSQL_ASSOC. All entries are arranged by id perfectly from 1 to whatever+ except for ONE (Look at screenshot)

I used this code:

while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
echo '<tr>
<td>'.$row['id'].'</td>
<td>'.$row['title'].'</td>
<td><a href="delete.php?id='.$row['id'].'">Delete</a></td>
<td><a href="edit.php?id='.$row['id'].'">Edit
</tr>';
}
} else {
echo 'Sorry, but we could not retrieve any news item records.';
}

Update: I looked in phpmyadmin and it gave me the same results...

abduraooft
02-27-2008, 07:29 AM
Have you given order by `column_name` ASC in your query?

Dat
02-28-2008, 02:09 AM
Question though, why does this happen in Myphpadmin??

Ultragames
02-28-2008, 02:37 AM
it is probably ordering by some other infomration than the ID, that is very close. For instance, if you were sorting by the date entered into the database, in nearly all cases the date entered will sort the same as teh ID ASC, but not always.

Like suggested before, add an order clause to your query. For PHPMyAdmin, go into that table's Operations tab, and change the Alter table order by to the ID, in ASC mode.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum