Note that there are some explanatory texts on larger screens.

plurals
  1. POIs there a better way to handle this PHP script? - Time out issue
    primarykey
    data
    text
    <p>I put together a simple script that pulls the product name, category name and product id from two tables. Then I take that data and use it to create a page title that's better than what I currently have for SEO purposes. For some reason I didn't think it would take as long as it's taking to run. There are 7k products. </p> <p>My hosting company does allow the creation of a custom php.ini so I was able to override the 30 second time limit and changed it to 6000. But still the script times out. So I thought my script my suck. :)</p> <p>Below is the script. Is there a better way I could write this so it doesn't time out? Or is what I'm trying to do just going to take some time and I need to write the script to do one category at a time?</p> <pre><code>&lt;?php // Make a MySQL Connection mysql_connect("localhost", "myusername", "mypassword") or die(mysql_error()); mysql_select_db("mydatabase") or die(mysql_error()); $result = mysql_query("SELECT isc_products.prodcode, isc_products.prodname, isc_categories.catname FROM isc_products, isc_categories WHERE isc_products.prodcatids = isc_categories.categoryid") or die(mysql_error()); while($row = mysql_fetch_array($result)){ $pname = mysql_real_escape_string($row['prodname']); $catname = mysql_real_escape_string($row['catname']); $sitename = Sitename; $prodcode = $row['prodcode']; $result2 = mysql_query("UPDATE isc_products SET prodpagetitle = '$pname - $catname - $sitename' WHERE prodcode = '$prodcode'") or die(mysql_error()); } ?&gt; </code></pre> <p><a href="http://www.threewestcreative.com/indexes.jpg" rel="nofollow noreferrer">indexes http://www.threewestcreative.com/indexes.jpg</a></p> <p>Thanks, your help is appreciated. :)</p> <p>Thanks SO much everyone! I really appreciate the quick responses. I can't believe I overlooked something so simple as running a direct query against the database (without php). Geez... Thanks again!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload