dotted i

  • Increase font size
  • Default font size
  • Decrease font size

SERVICES:

  • Website Development
  • Custom Web Forms
  • Joomla System Integration
  • Website Administration Training

CONTACT:

Home Home Tech Talk - Blog

PHP script – duplicate content in database, duplicate execution

Background: I developed a PHP scripts for Joomla/Virtuemart that could be used to import shipping/handling fees from a .csv file into Joomla’s jos_shipping_rate table.

Problem: Although the script executes and imports the data correctly whenever I would check the data via the Virtuemart admin interface, it showed duplicate entries which was confirmed by checking the Joomla/Virtuemart table from the MySQL prompt.

mysql> select shipping_rate_id, shipping_rate_name as name,shipping_rate_carrier_id as carrier_id,shipping_rate_currency_id as currency_id, shipping_rate_package_fee as package_fee from jos_vm_shipping_rate order by shipping_rate_id desc limit 4;

+------------------+--------+------------+-------------+-------------+
| shipping_rate_id | name   | carrier_id | currency_id | package_fee |
+------------------+--------+------------+-------------+-------------+
|            49903 | 1-2 lb |          2 |         144 |        1.00 |
|            49902 | 0-1 lb |          2 |         144 |        1.00 |
|            49901 | 1-2 lb |          2 |         144 |        1.00 |
|            49900 | 0-1 lb |          2 |         144 |        1.00 |
+------------------+--------+------------+-------------+-------------+
2 rows in set (0.00 sec)

Solution: I backed up the script and stripped it down to a barebones one-liner with output redirecting to a log file.

<?php
system ("date >> /home/matthelm/www/scripts/log.txt");
?>

Log.txt was still displaying double-execution. Huh? This rightfully so eliminated the import script, but did not solve the problem. I submitted a service request to the web host provider and they, of course, did not experience the problem but asked which browser I was using. The answer was Firefox on Ubuntu Linux. This got me to start thinking and led me to running the same script from Konqueror, Seamonkey and Ephphany on the same Linux PC. No trouble found!

As it happens I have a number of toolbars installed on Firefox. As soon as I disabled “Firebug 1.3.3” the problem went away.

Tags: , , ,

Leave a Reply


Latest Blog Posts