# Delete the current content of the table
$result = mysql_db_query('$sql_id',"DELETE FROM table_name") or die ("Invalid DELETE query");
# Optimize the current table (recover empty space)
$result = mysql_db_query('$sql_id',"OPTIMIZE TABLE table_name") or die ("Invalid OPTIMIZE query");
# Load local comma separated, fields enclosed by quotes text database - File has to be in the same directory of this file
$result = mysql_db_query('$sql_id',"LOAD DATA LOCAL INFILE 'export_file_name.txt' INTO TABLE table_name FIELDS TERMINATED BY ',' ENCLOSED BY '\"'") or die ("Invalid DATA LOAD query");
# Get how many records are present in the table now
$result = mysql_db_query('$sql_id',"SELECT * from table_name") or die ("Invalid SELECT query");
$rows_count = mysql_num_rows($result);
echo "Records: $rows_count"; mysql_free_result($result);