robert_gsfame Posted April 14, 2010 Share Posted April 14, 2010 I have tried to retrieve the record ['id'] which is an autoincrement number from database using mysql_fetch_array but then instead of getting the same result as what stored in database, i get this : 1 database: 25, 3, 7 mysql_fetch_array: 1, 1, 1 what is actually cause the problem, can anyone help me? thx Quote Link to comment https://forums.phpfreaks.com/topic/198458-mysql_fetch_array-problem/ Share on other sites More sharing options...
AdRock Posted April 14, 2010 Share Posted April 14, 2010 You need to show some code so we can see what the problem is Quote Link to comment https://forums.phpfreaks.com/topic/198458-mysql_fetch_array-problem/#findComment-1041376 Share on other sites More sharing options...
robert_gsfame Posted April 14, 2010 Author Share Posted April 14, 2010 this is just some code $selectquery=mysql_query("SELECT * FROM detail dg JOIN userlist dp ON dg.username=dp.username WHERE dg.province='Austin' LIMIT 0, 5"); while($selectarray=mysql_fetch_array($selectquery)){ $selectid=$selectarray['id']; echo $selectid."<br>"; } Quote Link to comment https://forums.phpfreaks.com/topic/198458-mysql_fetch_array-problem/#findComment-1041377 Share on other sites More sharing options...
robert_gsfame Posted April 14, 2010 Author Share Posted April 14, 2010 Just for info, there is no problem in retrieving other records except id Quote Link to comment https://forums.phpfreaks.com/topic/198458-mysql_fetch_array-problem/#findComment-1041379 Share on other sites More sharing options...
robert_gsfame Posted April 14, 2010 Author Share Posted April 14, 2010 I got some clue now.......i have to state one by one records that i want to SELECT, so instead of using *, i have to state dg.id Quote Link to comment https://forums.phpfreaks.com/topic/198458-mysql_fetch_array-problem/#findComment-1041382 Share on other sites More sharing options...
jcbones Posted April 14, 2010 Share Posted April 14, 2010 Mysql is most likely confused on which tables ID you want. Try: SELECT dg.* FROM detail dg JOIN userlist dp ON dg.username=dp.username WHERE dg.province='Austin' LIMIT 0, 5 Quote Link to comment https://forums.phpfreaks.com/topic/198458-mysql_fetch_array-problem/#findComment-1041383 Share on other sites More sharing options...
AdRock Posted April 14, 2010 Share Posted April 14, 2010 Mysql is most likely confused on which tables ID you want. Try: SELECT dg.* FROM detail dg JOIN userlist dp ON dg.username=dp.username WHERE dg.province='Austin' LIMIT 0, 5 I was just about to suggest that Quote Link to comment https://forums.phpfreaks.com/topic/198458-mysql_fetch_array-problem/#findComment-1041386 Share on other sites More sharing options...
robert_gsfame Posted April 14, 2010 Author Share Posted April 14, 2010 Yeah dg.* solve everything.....THX A LOT!!! Quote Link to comment https://forums.phpfreaks.com/topic/198458-mysql_fetch_array-problem/#findComment-1041387 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.