solinent Posted July 24, 2007 Share Posted July 24, 2007 Can I do the following in the SAME PHP script? INSERT some columns SELECT inserted columns along with others UPDATE all the columns. Quote Link to comment Share on other sites More sharing options...
Wildbug Posted July 24, 2007 Share Posted July 24, 2007 Sure, why not? As separate queries, of course. $query1 = "INSERT...."; $query2 = "SELECT..."; $query3 = "UPDATE..."; Quote Link to comment Share on other sites More sharing options...
solinent Posted July 24, 2007 Author Share Posted July 24, 2007 Yeah, I am doing that, but it doesn't seem to work. The SELECT doesn't return good results, or some error is happening. First I crawl some webpages, insert values into a table. Then, I SELECT the table in order, and then UPDATE it with the order number (because doing it with mysql every time would take too much time). This needs to run every day with cron, so I need to fit it in one script. It works if I separate the scripts. Quote Link to comment Share on other sites More sharing options...
Wildbug Posted July 24, 2007 Share Posted July 24, 2007 You should check for MySQL errors after each query, especially while debugging/writing code. 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.