rajaahsan Posted May 30, 2011 Share Posted May 30, 2011 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 ? Quote Link to comment https://forums.phpfreaks.com/topic/237909-sql-table-problem/ Share on other sites More sharing options...
fugix Posted May 30, 2011 Share Posted May 30, 2011 Looks to me like you don't have it set to auto-increment. ? Quote Link to comment https://forums.phpfreaks.com/topic/237909-sql-table-problem/#findComment-1222544 Share on other sites More sharing options...
rajaahsan Posted May 30, 2011 Author Share Posted May 30, 2011 no boss, i have already auto increment checked in database on my primary key which is "id" but problem remains the same why is it happening as my data successfully been saved but only sequence problem distirb me please help guyz.. Quote Link to comment https://forums.phpfreaks.com/topic/237909-sql-table-problem/#findComment-1222552 Share on other sites More sharing options...
fugix Posted May 30, 2011 Share Posted May 30, 2011 Did you double check that it is auto increment? If you add 5 or so items into your table does it still jumble the id? Quote Link to comment https://forums.phpfreaks.com/topic/237909-sql-table-problem/#findComment-1222553 Share on other sites More sharing options...
rajaahsan Posted May 31, 2011 Author Share Posted May 31, 2011 ya it is sure i have auto incremented checked in database and my id is primary id key but i dont understand what the problem is why my database jumble id's up and down... Quote Link to comment https://forums.phpfreaks.com/topic/237909-sql-table-problem/#findComment-1222732 Share on other sites More sharing options...
Muddy_Funster Posted May 31, 2011 Share Posted May 31, 2011 it's impossabe to tell from the information given if the sequencing is off on entry or return. MySQL does not automaticly return information in a set order, you need to use the "order by" clause for that - Try appending ORDER BY id at the end of the SELECT query and see what happens. Quote Link to comment https://forums.phpfreaks.com/topic/237909-sql-table-problem/#findComment-1222823 Share on other sites More sharing options...
fugix Posted May 31, 2011 Share Posted May 31, 2011 it's impossabe to tell from the information given if the sequencing is off on entry or return. MySQL does not automaticly return information in a set order, you need to use the "order by" clause for that - Try appending ORDER BY id at the end of the SELECT query and see what happens. if that is what his table looks like then the data is being inserted that way...I had a similar problem before but it was due to the fact that i thought that I had auto-increment on when in fact i didnt..this has me confused Quote Link to comment https://forums.phpfreaks.com/topic/237909-sql-table-problem/#findComment-1222871 Share on other sites More sharing options...
Muddy_Funster Posted May 31, 2011 Share Posted May 31, 2011 if that is what his table looks like then the data is being inserted that way...I had a similar problem before but it was due to the fact that i thought that I had auto-increment on when in fact i didnt..this has me confused As data is fetched asyncronously by MySQL, the id field is indead contiguious, the OP said that the column was deffinately auto_inc and the example dataset shows no indication of entry timestamping: I stand by (probably in complete error, but in the absence of a better idea) the issue being with select returning the data without a fixed order being declared. Quote Link to comment https://forums.phpfreaks.com/topic/237909-sql-table-problem/#findComment-1222881 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.