Jump to content

PHP, MSSQL, and JSON


mkswanson

Recommended Posts

I'm having problems with enabling the sort functions of jqgrid.  I think I've narrowed the problem down to the way MSSQL is returning the data to the SQL query.

 

In an effort to troubleshoot, I've drastically simplified the problem.  The query I'm using is below.

 

SELECT * FROM dbo.test ORDER BY locationName

 

When I run the query directly in MSSQL Management Studio, the top 5 ID entries are 132, 1309, 1295, 1281, 1267.

 

When I run the corresponding code in PHP, the top 5 ID entries are 1266, 1267, 1268, 1269, 1270 - it seems to be ignoring my order by clause.  Is there something I need to do to force it to honor the ORDER BY locationName?

 

$kpiQuery = "SELECT * FROM dbo.test ORDER BY locationName";
$result = mssql_query($kpiQuery);
while($kpiRow = mssql_fetch_array($kpiResult)) {
echo $kpiRow[plDataID]."<br>";
}

Link to comment
https://forums.phpfreaks.com/topic/261211-php-mssql-and-json/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.