SQL TABLE PROBLEM

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
shinstar
Forum Newbie
Posts: 18
Joined: Fri May 21, 2010 2:33 pm

SQL TABLE PROBLEM

Post by shinstar »

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 ?
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: SQL TABLE PROBLEM

Post by Celauran »

ORDER BY id ASC

No problem.
Last edited by Celauran on Wed Jun 01, 2011 8:42 am, edited 1 time in total.
User avatar
califdon
Jack of Zircons
Posts: 4484
Joined: Thu Nov 09, 2006 8:30 pm
Location: California, USA

Re: SQL TABLE PROBLEM

Post by califdon »

Fundamental characteristic of all relational databases: there is no defined sequence of rows. If you want to extract data in a particular sequence, you must always use the ORDER BY clause of your query.
Post Reply