PHP mysql database not populating values into tables -
i creating simple php program stores many rows of data tables. when run program populates 1 row of 10's of thousands of rows trying populate. doesn't give mysql_errors
.
this code:
<?php $tickets = explode(' ', file_get_contents("tickets.txt")); foreach($tickets &$ticket){ $handle = opendir($ticket); while($file = readdir($handle)){ if($file != "." && $file != ".."){ $raw_data = file_get_contents($ticket."/".$file); $raw_data = trim(str_replace("date,open,high,low,close,volume,adj close", "", $raw_data)); file_put_contents($ticket."/".$file, $raw_data); $file_temp = fopen($ticket."/".$file, "r"); while(!feof($file_temp)){ $line = fgets($file_temp); $data_array = explode(',', $line); $date = $data_array[0]; $open = $data_array[1]; $high = $data_array[2]; $low = $data_array[3]; $close = $data_array[4]; $volume = $data_array[5]; $adjclose = $data_array[6]; $query = mysql_query("insert `$ticket` values ('$date','$open','$high','$low','$close','$volume','$adjclose')"); if(mysql_query("select $ticket `date`='$date'")){ } else { echo "error"; } echo $date.$open.$high.$low.$close.$volume.$adjclose."<br>"; if(!$query){ mysql_error(); } } } } } ?>
Comments
Post a Comment