Author Topic: LMinsert.php implementation  (Read 4924 times)

ad

  • Posts: 15
    • View Profile
LMinsert.php implementation
« on: September 20, 2004, 09:02:41 am »
Hello Dean,

I am trying to accomplish the following:
I want to have a script run daily by a crontab which:

1. retrieves data (orderID, email, fname, lname) of clients which have ordered 10 days ago from a database of my shopping cart hosted at X. These are typically from 3-20 sets of data.
2. stores this data in Listmail hosted at Y at the same time and sending them a welcome Email.

While it's certainly no problem to retrieve the data for 1, it's a problem for me  to store this in Listmail using your script LMinsert.php.
I get the error message:
Fatal error: Cannot redeclare lminsert() (previously declared in /vitamobw/www.vitamine-und-mehr.org/virility/follow/LMinsert.php:44) in /vitamobw/www.vitamine-und-mehr.org/virility/follow/LMinsert.php on line 44

The reason for this is certainly that I have tried to accomplish the whole thing by setting a loop using
.
.
.
while(I retrieve the data from database X) {
(defining parameters)
include("LMinsert.php");
}
echo "done";

... and LMinsert.php opens a new database connection while the old one is still open.
You see I am not a savvy programmer. Can you give me a hint? Do I have somehow to close the first connection before letting LMinsert.php run?

Or is there an even more elegant solution?

Thanks

Wolfgang

P.S.: I changed the script supposed to do the job by using:

include_once('LMinsert.php');

This prevented the "cant redeclare"-error to appear. Nevertheless the data is not stored in my Listmail database!

DW

  • Administrator
  • Posts: 3787
    • View Profile
    • https://legacy.listmailpro.com
LMinsert.php implementation
« Reply #1 on: September 21, 2004, 01:21:07 pm »
It appears that the LMinsert function is being declared twice due to inclusion.  Perhaps you have uncommented the following lines from LMinsert.php:

// Example usage:
// include('LMinsert.php');
// LMinsert.php('1',$email);

This should not be uncommented in the LMinsert.php script itself.  Rather, the LMinsert.php script should be included from another script.
Dean Wiebe
ListMailPRO Author & Developer - Help | Support | Hosting