Hi
I have a problem in importing .xml files in my mysql database. my .xml file is also more than 3mb, so i change in my php.ini the upload_max_filesize = from 2MB to 100MB and also i change the max_execution_time = from 30 to 1200
but still i cannot import my .xml files.
no error displayed so i cannot configured out.
here is my code for the import:
andCode:<?php $data = array(); $con = mysql_connect("localhost", "root",""); if (!$con) { die(mysql_error()); } $db = mysql_select_db("payroll", $con); if (!$db) { die(mysql_error()); } $sql = "select * from regular_dtr"; $result = mysql_query($sql, $con); if (!$result) { die(mysql_error()); } function add_employee($EMP_NO, $Date, $DTR) { global $data; $con = mysql_connect("localhost", "root",""); if (!$con){ die(mysql_error());} $db = mysql_select_db("payroll", $con); if (!$db) { die(mysql_error()); } $EMP_NO = $EMP_NO; $Date = $Date; $Date = substr($Date,0,-13); $DTR = $DTR; $sql = "INSERT INTO regular_dtr (EMP_NO, DATE_DTR, DTR) VALUES ('$EMP_NO', '$Date', '$DTR')"; mysql_query($sql, $con); $data []= array('EMP_NO' => $EMP_NO, 'DATE_DTR' => $Date, 'DTR' => $DTR); } if ( $_FILES['file']['tmp_name'] ) { $dom = DOMDocument::load( $_FILES['file']['tmp_name']); //ini_set('memory_limit', '150MB'); $rows = $dom->getElementsByTagName( 'Row' ); global $last_row; $last_row = false; $first_row = true; foreach ($rows as $row) { if ( !$first_row ) { $EMP_NO = ""; $Date = ""; $DTR = ""; $index = 1; $cells = $row->getElementsByTagName( 'Cell' ); foreach( $cells as $cell ) { $ind = $cell->getAttribute( 'Index' ); if ( $ind != null ) $index = $ind; if ( $index == 1 ) $EMP_NO = $cell->nodeValue; if ( $index == 2 ) $Date = $cell->nodeValue; if ( $index == 3 ) $DTR = $cell->nodeValue; $index += 1; } if ($EMP_NO=='' and $Date=='' and $DTR=='') { $last_row = true; } else { add_employee($EMP_NO, $Date, $DTR); } } if ($last_row==true) { $first_row = true; } else { $first_row = false; } } } ?>
I hope someone can help me..cause i need to solve it urgently..Code:<html> <body> <form enctype="multipart/form-data" action="import_reg_att.php" method="post"> <input type="hidden" name="MAX_FILE_SIZE"/> <table width="600"> <tr> <td>Employee Attendance:</td> <td><input type="file" name="file" /></td> <td><input type="submit" value="Upload" /></td> </tr> </table> </form> </body> </html>
I tried to search solution and when I tried like the editing php.ini, it did not work.
Thank you



Reply With Quote
Bookmarks