jakebur01 Posted May 12, 2011 Share Posted May 12, 2011 I do not have the option that I know of to do a LIMIT 10 in my odbc query. How can I get it to count the number of while loops and stop at 10? while (odbc_fetch_row($rs)) { } Quote Link to comment https://forums.phpfreaks.com/topic/236257-doing-only-10-while-loops/ Share on other sites More sharing options...
Maq Posted May 12, 2011 Share Posted May 12, 2011 I do not have the option that I know of to do a LIMIT 10 in my odbc query. What do you mean exactly? I'm asking because this would be the best option. How can I get it to count the number of while loops and stop at 10? Have a variable that increments each loop and have a condition to check whether it reaches 10. Quote Link to comment https://forums.phpfreaks.com/topic/236257-doing-only-10-while-loops/#findComment-1214672 Share on other sites More sharing options...
requinix Posted May 12, 2011 Share Posted May 12, 2011 T-SQL has TOP and Oracle has ROWNUM. What SQL flavor? Quote Link to comment https://forums.phpfreaks.com/topic/236257-doing-only-10-while-loops/#findComment-1214686 Share on other sites More sharing options...
jakebur01 Posted May 12, 2011 Author Share Posted May 12, 2011 PROVIDEX Quote Link to comment https://forums.phpfreaks.com/topic/236257-doing-only-10-while-loops/#findComment-1214707 Share on other sites More sharing options...
btherl Posted May 12, 2011 Share Posted May 12, 2011 ProvideX! I looked at the manual and I see why you want to do this in php. Here's one way to do it: $rowcount = 0; while ($rowcount < 10 && odbc_fetch_row($rs)) { $rowcount++; # Process the row } Quote Link to comment https://forums.phpfreaks.com/topic/236257-doing-only-10-while-loops/#findComment-1214717 Share on other sites More sharing options...
Maq Posted May 13, 2011 Share Posted May 13, 2011 PROVIDEX Never even heard of that. *Googles*. Quote Link to comment https://forums.phpfreaks.com/topic/236257-doing-only-10-while-loops/#findComment-1214977 Share on other sites More sharing options...
jakebur01 Posted May 13, 2011 Author Share Posted May 13, 2011 Any query you try to do with it is slow as all get out. I was using navicat to import the item data over to MySQL and it has been loosing its connection during the middle of the transfer. There are a little over 100,000 items. I know it can't be navicat, because I have imported from other ODBC connection types with about 300,000 rows and 20 or more columns. I'm think about building some kind of custom update/transfer script with php. Jake Quote Link to comment https://forums.phpfreaks.com/topic/236257-doing-only-10-while-loops/#findComment-1214983 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.