Sunday, 15 September 2013

Inputing multiple inputs into database, PHP -



Inputing multiple inputs into database, PHP -

i need input multiple data, in 50000 different sets of info database txt file. info inputed shown.

chr 166999824 67210768 nm_032291

they separated tab.

is there way help input numerous different info without inputting in 1 one? using netbeans , mysql this. different tables gene_id (primary key) chromosome start_position end_position strand accession_number.

example of database

gene_ id : 1

chromosome: chr1

start_position : 66999824

end_position: 67210768

strand : positive ( either positive or negative)

accession_number : nm_032291

thank you.

<?php $f=fopen('file.txt','r'); //file function reads entire file array $list = file($f,file_skip_empty_lines); //this connection database function db_connect(); foreach($list $data) { $x = explode("\t", $data); $chromosome=$x[0]; $start_position=$x[1]; $end_position=$x[2]; $strand=$x[3]; $accession_number=$x[4]; $query="insert table_name values ('$chromosome','$start_position','$end_position','$strand','$accession_number')"; mysql_query($query) or die("error insert query"); } fclose($f); ?>

php database netbeans sqliteopenhelper

No comments:

Post a Comment