I want a php script to see b .txt file.

This content from the text file are just like this:

data.txt

145|Joe Blogs|17/03/1954
986|Jim Smith|12/01/1976
234|Paul Jones|19/07/1923
098|James Smith|12/09/1998
234|Carl Jones|01/01/1925

These would then get saved right into a database such as this

*DataID Title DOB *

234    |Carl Jones|01/01/1925

I'd be so grateful if a person could produce script to do this.

Update:

<?
$handle = @fopen("data.txt", "r");
$conn = mysql_connect("localhost","username","password"); 
mysql_select_db("mydatabase",$conn);
while (!feof($handle)) // Loop til end of file.
{
$buffer = fgets($handle, 4096);
 // Read a line.
list($a,$b,$c)=explode("|",$buffer);
//Separate string by the means of |
echo $a."-".$b."-".$c."<br>";
$sql = "INSERT INTO data_table (iddata, name, age) VALUES('".$a."','".$b."',".$c.")";   
mysql_query($sql,$conn) or die(mysql_error());
}
?>

obtain the following error error inside your SQL syntax ...for the best syntax to make use of near ')' at line 1

That which you might be searching for is MySQL's built-in function [cde] to load a text file that contains values for any database right into a database.

The Burden DATA INFILE statement reads rows from the text file right into a table in a high speed. The file title should be given like a literal string.

Example:

LOAD DATA INFILE

You might specify the delimiters inside your text-file, like so:

LOAD DATA INFILE 'data.txt' INTO TABLE my_table;

Update:

This is a full-working example, I submitted an evaluation computer file here here is my PHP code.

LOAD DATA INFILE 'data.txt' INTO TABLE my_table FIELDS TERMINATED BY '|';

Here exactly what the table looked before you run my PHP code:

$string = file_get_contents("http://www.angelfire.com/ri2/DMX/data.txt", "r");
$myFile = "C:/path/to/myFile.txt";
$fh = fopen($myFile, 'w') or die("Could not open: " . mysql_error());
fwrite($fh, $string);
fclose($fh);

$sql = mysql_connect("localhost", "root", "password");
if (!$sql) {
    die("Could not connect: " . mysql_error());
}
mysql_select_db("my_database");
$result = mysql_query("LOAD DATA INFILE '$myFile'" .
                      " INTO TABLE test FIELDS TERMINATED BY '|'");
if (!$result) {
    die("Could not load. " . mysql_error());
}

Here is the end result after:

mysql> select * from test;
+--------+-----------+------------+
| DataID | Name      | DOB        |
+--------+-----------+------------+
|    145 | Joe Blogs | 17/03/1954 |
+--------+-----------+------------+
1 row in set (0.00 sec)

open txt file using fopen:
$handle = @fopen("abc.txt", "r") //read line 1 by 1

$values=''

while (!feof($handle)) // Loop til finish of file.

",$buffer)//Separate string through the way of

//values.=($a,$b,$c)// save values and employ place query finally or

use mysql place query here

THATS IT