Home > MySQL, PHP, XML > Xml To Mysql (php Script)

Xml To Mysql (php Script)

November 22nd, 2009

Exchange Rates given buy bank in XML Format online:

www.bank.lv/eng/main/all/finfo/notvalkur/erbl_inxml/

I need 2 PHP simple scripts that parce & extract

- Date
- ID
- Units
- Rate

and insert data into existing MySQL table:

CREATE TABLE “currency” (
“date” DATE,
“id” CHAR(3),
“units” INTEGER,
“rate” NUMERIC(12,8),
PRIMARY KEY (“date”, “id”)

1. First script – extract and insert data into MySQL table according to defined period between 2 dates (will be used to fill table with past data).

2. Second script – extract and insert data into MySQL table only for current day (will be used as daily cron job).

You can create one script for both cases if you like, give me only editing instructions in order to achieve both tasks.

XML file source is attached in PDF.


Xml To Mysql (php Script)

Categories: MySQL, PHP, XML Tags: , , , , , ,
Comments are closed.
Bear