Sepodati Posted September 19, 2017 Share Posted September 19, 2017 (edited) This actually makes the most sense. The only thing is I'm not sure of is the 'values' part of the insert. Since I've already retrieved everything in the first select statement, I would basically need to insert the values based on index or column name and loop it. What would be the syntax there, as opposed to explicit values like you showed? Depends on exactly how you retrieve them in the query, but you'd likely build it something like $insert[] = "({$row['sessionid']}, {$row['name']}, {$row['number']})"; within the loop, for each row, then implode() that $insert array with a comma value when you're ready to tack it on to the end of the actual query. $query = "INSERT INTO proddb.tablename (sessionid, name, phone, ...) VALUES " . implode(',', $insert); Include your actual column names and make sure the number of columns listed matches the number of values in each VALUE () element and all that jazz. This is just an example. -John Edited September 19, 2017 by Sepodati Quote Link to comment 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.