Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

XML, PHP, mySQL, and Perl CGI

Status
Not open for further replies.

TopoGijo

Technical User
Jan 13, 2002
1
0
0
CA
Hello everyone,

I have a mySQL DB for my phpshop ( ) which stores the users information while sign-up. In the form I am adding a "Register me to your newsletter" checkbox. The thing is my newsletter application is not
connected to the mySQL DB. It is a separate application that uses Perl CGI scripting and creates its own DB files you can see it here I would like to use an XML script that would extract the email from mySQL DB and add it to the newsletter DB. Is this even possible? And if it is would it be a great challenge to implement? Is there better easier methods to do this? I am novice with XML, PHP, and Perl, most of what I can do is understand the logic of the code and edit it according to my needs.

Thank you,
 
TopoGijo --

When it comes to programming... almost anything is possible if you're resourceful enough ~smile~

How complicated it would be would depend on your e-mail program database. Does it already have a field to match the one in the MySQL database you are needing to copy? If so, it shouldn't be too difficult a task.

Assuming the field you need is already in the e-mail program database, the "simple" solution would be to use the code you already have for that program and use it to walk the e-mail program's database. For each person in that database, select that person's record from the MySQL database and copy hte needed data to the e-mail program data record for that person and save it back.

It would appear you already have code for both programs, so it would "just" be a matter of finding the right code snippets and putting them back together. You would need the following five code fragements to make it work...

From the E-mail program...

1) The code to retrieve a record from the database
2) The code to modify a field in that record
3) The code to save a modified record back to the database

From the MySQL program

1) The code to retrieve a specific record from the database
2) The code to retrieve a specific field from the record

You would then put it together as follows...

For every record in the e-mail database
{
Read a record from the e-mail database
Select the same user's record from the MySQL database
Get the e-mail field from the MySQL record
Copy the e-mail field into the e-mail database record
Save the e-mail database record
}

That's a fairly generic brand of help, but I hope it gives you enough to get started.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top