If i comment out the while loop my code works. I've never had any issues with while loops. The error says 500 - Internal Server Error "There is a problem with the resource you are looking for, and it cannot be displayed." Any Help is appreciated.
ini_set('memory_limit', '2048M');
ini_set('display_errors',1);
ini_set('display_startup_errors',1);
error_reporting(-1);
$conn = odbc_connect("Driver={SQL Server};Server=name; Database=main;", "user", "") or die ('001 DB Connection Failed.');
$final = trim($_POST['po']);
//$final = "1234567','1245698; this is what this variable looks like.
$sql = "select * from Table where id in ('$final')";
$table = '';
$query = odbc_exec($conn, $sql);
echo $sql;
$table = '<table class="table table-hover">
<thead>
<tr>
<th>header</th>
<th>header</th>
<th>header</th>
<th>header</th>
<th>header</th>
<th>header</th>
</tr>
</thead>
<tbody>';
while ($dataRow = odbc_fetch_array($query))
{
$table .= '<tr>
<td>'. $dataRow['data1'] .'</td>
<td>'. $dataRow['data1'] .'</td>
<td>'. $dataRow['data1'] .'</td>
<td>'. $dataRow['data1'] .'</td>
<td>'. $dataRow['data1'] .'</td>
<td>'. $dataRow['data1'] .'</td>
</tr>';
}
$table .= ' </tbody>
</table>';
echo $table;
?>
I would uncomment the while loop, but comment the block inside it. if it's not 500, it means that $datarow['data1'] that is not exist in the result.
secondly $sql = "select * from Table where id in ('$final')";
will give you a broken query. $final
will not have a correct quote/single quote required.