View Full Version : Sql table problem
05-30-2011, 10:36 PM
HY every one , i am having problem with my phpmysql database , i save different values form form but when i save multi values at a time the values saved in database successfully but the sequence of my praimary id changes , e.g
id firstname lastname dob
1 abc abc abc
3 abc abc abc
2 abc abc abc
4 abc abc abc
5 abc abc abc
so own but as you see 2 must be before the value 3 so any one tell me what is the problem in database ?
05-30-2011, 10:52 PM
You seem to be under the assumption that records in a database are *ORDERED* the same as their ID or primary key.
The records can (and often are) stored in random order.
If you want them in a particular order, you MUST use the ORDER BY clause in your SQL SELECT statement.
SELECT * FROM yourtablename ORDER BY id
05-31-2011, 08:39 AM
you are right but how to save this qurey in sql forever it just runs only one times and when i exit from sql table the qurey is set to defalt which again jumble up some values as i have auto incriment checked but stil my primary key which is "id" save up and down in the table which creats problem in other scripts that i have made help me plzzzz.
06-01-2011, 01:09 AM
Your other scripts also need to order the results correctly when they query the database.
Powered by vBulletin® Version 4.2.2 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.