I am using MySQL Workbench.
I have created the following table.
It contains the folllowing data. They are in alphabetical order except the last two - 50 and 51.
I am attempting to sort via 'name' it via this PHP code:
And this is the result:
So it appears as thought the ORDER BY part of my SQL query is being ignored. What is causing that?
I can't check the query in Workbench because there does not seem to be anyway you view the sorted data output of a query in it.
I have created the following table.
It contains the folllowing data. They are in alphabetical order except the last two - 50 and 51.
I am attempting to sort via 'name' it via this PHP code:
PHP:
function DoGenerateAdditionalTradesCheckBoxes()
{
global $g_dbFindATradie;
$nCount = 0;
$nNumCols = 20;
$queryResult = $g_dbFindATradie->query("SELECT id, name, description FROM trades ORDER BY name");
while ($row = $queryResult->fetch_assoc())
{
if (($nCount == 0) || (($nCount % $nNumCols) == 0))
echo "<td>";
echo "<input type=\"checkbox\" id=\"check_" . $row["name"] . "\" name=\"" . $row["name"] . "(" . $row["id"] . ")\" onclick=\"OnClickTradesCheck(this)\" />";
echo "<label>" . $row["name"] . "</label><br/>";
$nCount++;
if (($nCount % $nNumCols) == 0)
{
echo "<td>";
$nCount = 0;
}
}
$queryResult->free_result();
}
And this is the result:
So it appears as thought the ORDER BY part of my SQL query is being ignored. What is causing that?
I can't check the query in Workbench because there does not seem to be anyway you view the sorted data output of a query in it.