benk1 0 Newbie Poster

Hi

I have a problem as detailed below. I hope the answer is something really simple:

$connect = new PDO("sqlite:main.db");

$sql = "SELECT * FROM employee ORDER BY Surname"; 

echo "<table align='center' border='1'>"; 

foreach ($connect->query($sql) as $info) 
{ 
$FirstNames=$info['FirstNames'];
$Surname=$info['Surname'];
$EmployeeID=$info['EmployeeID'];
$TagID=$info['TagID'];

echo "<tr align='center'>"; 
echo "<td width='16%'> $FirstNames </td>";
echo "<td width='16%'> $Surname </td>";
echo "<td width='16%'> $EmployeeID </td>"; 
echo "<td width='16%'> $TagID </td>"; 
echo "</tr>"; 
}

This returns the data in the same order with or without the ORDER BY clause (as in sorted by database ID, not Surname).

Little help?