Open your file in excel and save it as a comma separated text file. Then use the following code:
[pre]
$dbHost = "your_db_host";
$dbName = "your_db_name";
$dbUser = "your_username";
$dbPass = "your_password";
// DB connect
function dbConnect() {
global $dbHost, $dbUser, $dbPass, $dbName;
mysql_pconnect("$dbHost", "$dbUser", "$dbPass")
or die("Error1: Sorry, a connection to the database could not be made. Please try again later.");
mysql_select_db("$dbName")
or die("Error2: Sorry, unable to select database $dbName. Please try again later.");
}
dbConnect();
$fcontents = file ('your_file.txt');
for($i=0; $i<sizeof($fcontents); $i++) {
$line = trim($fcontents[$i]);
$arr = explode("\t", $line);
$sql = "insert into users values ('". implode("','", $arr) ."')";
mysql_query($sql);
echo $sql ."<br>\n";
if(mysql_error()) {
echo mysql_error() ."<br>\n";
}
}
[/pre]