Hi everyone, i hope i can find the solution for my problem here. I have to import a structured xml file to mysql database. the xml file contains economic information of the company (sells/transactions, etc etc) and in the php site diferent kinds of information are viewed for diferent types of users... I hope i've made the question clear and pardon my english
This question should actually have been asked in the PHP section, since I don't think it would be smart to try to accomplice this with javascript, but here is a php code that might help: function insertIntoMySQL($filename, $tablename) { $xml_file = fopen($filename, "r"); $this->xml->read_file_handle($xml_file); $numRows = $this->xml->roottag->num_subtags(); for ($i = 0; $i < $numRows; $i++) { $arrFields = null; $arrValues = null; $row = $this->xml->roottag->tags[$i]; $numFields = $row->num_subtags(); for ($ii = 0; $ii < $numFields; $ii++) { $field = $row->tags[$ii]; $arrFields[] = $field->name; $arrValues[] = "\"".$field->cdata."\""; } $fields = join($arrFields, ", "); $values = join($arrValues, ", "); $this->recordSet->exec("Insert Into $tablename ($fields) Values ($values)"); } } PHP: