Hello everyone,
I am having trouble populating an HTML table from my MS SQL database. I have have done this with a two column table, but the code I used doesn’t seem to work with the 6 column table I am trying to populate now.
Here is the code that I am using
if( $totalFailures > 0 ) {
$sql_messageFailures = "select a.FileName, a.FilePageCount, a.EmailIDFrom, a.EmailIDTo, a.Subject, b.ErrMessage FROM tbl_xTalk_Main a, tbl_xTalk_ErrorMsg b where a.ID=b.id and DATEPART(month, DateInserted)=DATEPART(month, getdate()) and DATEPART(day, DateInserted)=DATEPART(day, getdate()-1) and ProcessStatus = 0 order by a.ID";
$qry_messageFailures = sqlsrv_query($conn, $sql_messageFailures);
/*if( sqlsrv_fetch( $qry_totalFailures ) === false) {
die( print_r( sqlsrv_errors(), true));
}*/
?>
FileName
FilePageCount
EmailIDFrom
EmailIDTo
Subject
ErrMessage
<?php
while($row = sqlsrv_fetch_array($qry_messageFailures, SQLSRV_FETCH_NUMERIC)){
?>
<?php echo $row[0];?>
<?php echo $row[1];?>
<?php echo $row[2];?>
<?php echo $row[3];?>
<?php echo $row[4];?>
<?php echo $row[5];?>
<?php
}
?>
<?php
}
I am getting the header names, but I am not getting anything from the while loop. The rest of the data on the page that comes after this works fine. Also, the header names are not underlined for some reason.
Any help would be great.
Thanks