quasiman Posted August 20, 2009 Share Posted August 20, 2009 As the subject says...I crashed my server with this. It runs for a long time, but never finishes, and ends up with my server in a 500 error. No error messages, even with the error reporting at the top. Here's what I'm trying to do. I have two tables of product info, and two tables for my production shop. I need to clean up the data in my product info tables, and then use that to update my shop. As I'm positive the only problem here is my sql query, I'm only posting that part...I'd appreciate anyone that can help me out with this! <?php /*....database connection, and emailing me the results stuff go above here.... */ $query = "UPDATE shop_product_price pr,shop_product p,mydata md, mydata_cnet cn SET pr.product_price = (trim(REPLACE(md.MSRP,',','')) + trim(REPLACE(wd.Cost,',',''))) / 2, p.product_in_stock = md.Available, p.product_desc = cn.MarketingDesc WHERE pr.product_id = p.product_id AND p.product_sku = md.PartNumber"; $result = mysql_query($query) or die(mysql_error()); if (!$result) { die('Invalid query: ' . mysql_error()); } else {$body .= "Prices & Stock Updated";} mysql_close($linkID); if (mail($to, $subject, $body, $headers)) { echo("<p>Message successfully sent!</p>"); } else { echo("<p>Message delivery failed...</p>"); } ?> Link to comment https://forums.phpfreaks.com/topic/171092-solved-multiple-mysql-updatesserver-crashed/ Share on other sites More sharing options...
quasiman Posted August 20, 2009 Author Share Posted August 20, 2009 Is it possible that my script is failing simply because I have so many records? 18000+ Link to comment https://forums.phpfreaks.com/topic/171092-solved-multiple-mysql-updatesserver-crashed/#findComment-902357 Share on other sites More sharing options...
phpdeveloper82 Posted August 20, 2009 Share Posted August 20, 2009 I don't think that, its possible to UPDATE two tables in a single query. It is possible in a singlq query, but you have separate them with a semicolon. Its better to create tow functions to update the table "shop_product_price,shop_product". Just read the values from table & update with the tables......easy job Link to comment https://forums.phpfreaks.com/topic/171092-solved-multiple-mysql-updatesserver-crashed/#findComment-902362 Share on other sites More sharing options...
quasiman Posted August 20, 2009 Author Share Posted August 20, 2009 That did it - thanks! Link to comment https://forums.phpfreaks.com/topic/171092-solved-multiple-mysql-updatesserver-crashed/#findComment-902388 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.