Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8702063
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T02:33:25+00:00 2026-06-13T02:33:25+00:00

Having a problem trying to return field names from an MSSQL database via odbc

  • 0

Having a problem trying to return field names from an MSSQL database via odbc in php. My query is as follows:

SELECT t.ID, t.end_user, ts.name 'status', tp.name 'priority' FROM tickets t INNER JOIN status ts ON ts.ID = t.status INNER JOIN priorities tp ON tp.ID = t.priority

Problem is, when I run this on the MSSQL server, the column names come up as expected (ID, end_user, status, priority), but when I run it on my page, I get “name” for both the status and priority columns.

Is there any rhyme or reason why it’s not seeing my renaming of the columns? I tried using “AS” in the query, no luck.

Box is ubuntu running FreeTDS odbc driver version 7.2

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T02:33:27+00:00Added an answer on June 13, 2026 at 2:33 am

    I just spoke to J_D on the phone, (total internet stalk!), he suggested adding

    +''

    to a column name. That seems to circumvent this bug. The above code would have to be changed to

    SELECT t.ID, t.end_user, ts.name+'' 'status', tp.name+'' 'priority' FROM tickets t INNER JOIN status ts ON ts.ID = t.status INNER JOIN priorities tp ON tp.ID = t.priority
    

    which is a bit of a hack, but it will work. Apparently this is the result of some sort of bug in PHP when it tries to decipher ODBC results.

    If anyone has a suggestion that does not involve altering SQL code, I personally would much appreciate it, saves me altering pages and pages of SQL code.

    In other news, J_D, thank you for being such a gentleman on the phone to a random stranger.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am having a few problems trying to return a table from a SQL
I'm having a problem with a WCF service trying to consume it from Java.
I am having a problem trying to use the prependTo() function in jQuery... for
I'm having a problem trying to format the output on the jQuery UI datepicker.
I'm having a problem trying to create a Javascript function that checks all the
I'm having a problem trying to make eclipse and aspectj work for Dynamic Web
I'm having a problem when trying to pass an array back to a COM
I am having problem that when i am trying to submit the form by
I have been having this annoying problem when trying to implement a picture gallery
I'm having a pretty big problem trying to create navigation on my page. If

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.