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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.