insert php code into datatables

insert php code into datatables

jjf3jjf3 Posts: 5Questions: 0Answers: 0
edited October 2013 in General
I have a php code that currently creates a html file from a txt file and updates every two hours on my website. I would like to convert it to data tables. Is there an easy way to link to the txt file using jquery, data tables and php?

This is what I am making: http://live.datatables.net/eduvin/edit#javascript,html

This is the php code currently:

[code] $fp=fopen("csv/inventory4.html",'w');
$write=fputs($fp,$html_body,strlen($html_body));
$i=0;
$content = file("webinvt.txt");
foreach($content as $line)
{
$l=csv_split($line);
if(!strstr($l[11],"SET"))
{
if($i==10)
{
$tmp = '

';
$write=fputs($fp,$tmp,strlen($tmp));
$i=0;
}
$onhand = (int)$l[15];
$committed = (int)$l[16];
$avail = $onhand - $committed;
$wcdate = substr($l[23],4);
$eastdate = substr($l[19],4);

if(strstr($l[1],"DISC"))
{
$html_body ='
'.$l[0].'
'.$l[1].'
'.$l[12].'
'.$avail.'
'.$l[17].'
'.$l[18].'
'.$eastdate.'
'.$l[21].'
'.$l[22].'
'.$wcdate.'
';
}
else
{
$html_body ='
'.$l[0].'
'.$l[1].'
'.$l[12].'
'.$avail.'
'.$l[17].'
'.$l[18].'
'.$eastdate.'
'.$l[21].'
'.$l[22].'
'.$wcdate.'

';
}

$write=fputs($fp,$html_body,strlen($html_body));
$i++;
}
}

$html_body='















';

$write=fputs($fp,$html_body,strlen($html_body));

fclose($fp);

?>

[/code]
This discussion has been closed.