<?php
$dbhost = 'localhost';
$dbuser = 'root';
$dbpass = 'WELCHgrape55';
$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql');
$dbname = 'dasr';
mysql_select_db($dbname);

$bedfile_field = array ( 'bedfile_id','experiment_id','method_id','genome_id','filetype','name','upload_date','expiration','header','descr');
$bedfile_field = join(',',$bedfile_field);
$microbed_field = array('microbed_id','bedfile_id', 'chrom', 'chromstart', 'chromend', 'name', 'score', 'strand', 'thickstart', 'thickend', 'itemrgb', 'remainder', 'blockcount', 'blocksizes', 'blockstarts');
$microbed_field = join(',', $microbed_field);


##  sixe
$bedfile_id = 6;
$q = "INSERT INTO bedfile_real (bedfile_id,filetype,name,upload_date,header,descr) VALUES ('$bedfile_id','microbed','WS4_hypox_allprobes.bed',NOW(),'real bed file','mouse_probes description=mouse probes itemRgb=On')";
mysql_query($q) or die (mysql_error());
$myFile = "../testing/DB_Data/Type_C_microarray/WS4_hypox_allprobes.bed";
$fh = fopen($myFile,'r') or die ("No such a file");
while( $line = fgets($fh))
{
if (!preg_match("/track/",$line))
	{
$line_array = explode("\t",$line);
$q="insert into microbed_real 
(bedfile_id,chrom,chromstart,chromend,name,score,strand,itemrgb) 
values 
('$bedfile_id','$line_array[0]','$line_array[1]','$line_array[2]','$line_array[3]','$line_array[4]','$line_array[5]','$line_array[8]')";
mysql_query($q) or die (mysql_error());
	}
}

?>