Caffeinenyx Posted May 5, 2011 Share Posted May 5, 2011 I have a list of ID's returned from a table (even number). I always used a loop to get the next result, but I want to put these straight into a new table INSERT INTO table VALUES ($ID1, $ID2); This is recursive till there are no more ID's. How do I get the result then the next result without loops. ID1 and ID2 cannot be null. What is the best way? Quote Link to comment https://forums.phpfreaks.com/topic/235651-get-next-result-without-array/ Share on other sites More sharing options...
incubi1 Posted May 6, 2011 Share Posted May 6, 2011 Hi, let me make sure I understand what you're asking. You want to copy values from one db table to another directly without looping through each ID field, is that correct? incubi Quote Link to comment https://forums.phpfreaks.com/topic/235651-get-next-result-without-array/#findComment-1211234 Share on other sites More sharing options...
btherl Posted May 6, 2011 Share Posted May 6, 2011 Can I also clarify that you want to get 2 items from the id list and insert both ids into one row of the new table? Quote Link to comment https://forums.phpfreaks.com/topic/235651-get-next-result-without-array/#findComment-1211246 Share on other sites More sharing options...
fugix Posted May 6, 2011 Share Posted May 6, 2011 and can i ask why you want to do it without using loops? loops is the easiest way Quote Link to comment https://forums.phpfreaks.com/topic/235651-get-next-result-without-array/#findComment-1211247 Share on other sites More sharing options...
spiderwell Posted May 6, 2011 Share Posted May 6, 2011 you will be going round in circles otherwise....... Quote Link to comment https://forums.phpfreaks.com/topic/235651-get-next-result-without-array/#findComment-1211251 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.