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. Link to comment https://forums.phpfreaks.com/topic/61566-update-after-insert/ 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..."; Link to comment https://forums.phpfreaks.com/topic/61566-update-after-insert/#findComment-306409 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. Link to comment https://forums.phpfreaks.com/topic/61566-update-after-insert/#findComment-306420 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. Link to comment https://forums.phpfreaks.com/topic/61566-update-after-insert/#findComment-306459 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.