While parsing into a mysql database using php, I have successfully entered data into the database from an uploaded txt file. My problem surrounds the fact that in between every data filled record in the database, is an empty record. What causes this? my test code is attached. thanks, kit _________________________________________________________________ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp
<?php $dbname="mydb"; if (!($db = mysql_connect($dbhost, $dbuser, $dbpass))) echo "error connecting to ". $dbname ."on ". $dbhost; mysql_select_db($dbname,$db); $file = file("/usr/local/mysql/bin/datafiles/test.txt"); while (list($key, $val) = each ($file)) { $data = explode("\t", $val); $sql = sprintf("INSERT into Roster VALUES ('%s', '%s', '%s', '%s', '%s', '%s')", $data[0], $data[1], $data[2], $data[3], $data[4], $data[5]) $result = mysql_query($sql, $db); } ?>
--------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php