| Support Center

(Back to Website)

Support Center

Name is required.
Email address is required.
Invalid email address
Answer is required.
Exceeding max length of 5KB

Aliased columns on JOIN

Ken Sep 01, 2017 02:05AM PKT

This software seems to have a hell of a hard time dealing with aliased columns on a JOIN. I can't get them to show on the grid about half the time, even though my code between php programs is very similar -- just the query part is different.

Example: $g->select_command = "SELECT prim_key, a.file_name , a.sign_date, CONCAT(b.firstname, ' ', b.lastname) AS person FROM vdocs a JOIN vmems b ON b.groupId = a.vendor_id AND b.member_id = a.vdoc_mem_id "

The field "person" will not show up in the grid, even though it looks like pretty simple code to display it. And yeah, it DOES show up in my phpmyadmin when I do a query.
The grid 'definition' is this:
$col = array();
$col["title"] = "Signed By";
$col["name"] = "person"; // grid column name, same as db field or alias
$col["width"] = "40";
$col["editable"] = false;
$col["search"] = false;
$cols[] = $col;

It doesn't work when I prefix the field with the table name, when I use it as "b.person", when I use it as "person" AND it doesn't even work if I just select 'lastname' and use that in '$col["name"]'. It doesn't show up in the JSON Response, so yeah I see that. But I don't care -- I'm not the one who wrote the JSON; I'm just trying to save time writing reports and I seem to be wasting it instead of saving it.

So what's the deal here? I've had the same issues with almost EVERY OTHER alias I've used with phpgrid. I've poured over the forums and the documentation and nothing I see answers this.

Up 0 rated Down
Abu Ghufran Sep 01, 2017 05:13AM PKT PHP Grid - Support Center Engineer
Please share complete code for review.
You can use pastebin.com OR email me at gridphp@gmail.com
Up 0 rated Down
Ken Sep 01, 2017 05:40AM PKT
I'll email it to you a bit later, because I gave up on this grid for this report. This should have been simple, as it only requires a display of four columns, although the data is from 3 different tables (our tables are heavily normalized). I re-wrote the program using standard HTML and SQL to render the correct data, along with filters to select certain groups. I wrote it 'from scratch' in a little over 40 minutes. I've been fighting with your grid for over 3 days trying to get it to render the same data.
So when I get caught up on the time I've wasted on this, I'll email the code to you for your comments. Thanks
Up 0 rated Down
Ken Sep 01, 2017 07:05AM PKT
Ok, I've emailed you the code.
Up 0 rated Down
John G Sep 10, 2017 01:40AM PKT

any news about this issue?

I have the exact same problem, same grid, search/dropdown works for every column except the name column.


Up 0 rated Down
Abu Ghufran Sep 12, 2017 07:01AM PKT PHP Grid - Support Center Engineer
This case was resolved via remote session.
Issue was in syntax of query and fixing it solved the issue.

@John, please share code for review. I'll review and suggest whats missing.

Post Your Public Answer

Your name (required)
Your email address (required)
Answer (required)

Contact Us

  • Post a Public Question
  • Email Us
  • Live Chat!
  • Ask the Community


    • Paste complete code that is involved in your question. You can use pastebin.com to share code link.

    Screenshots or Online link of webpage is helpful in resolution. You can also send email at address mentioned below.

    • To report an issue, Write steps to regenerate the case.

    • For email support or live chat, Use gridphp@gmail.com and add it in Google Chat.
seconds ago
a minute ago
minutes ago
an hour ago
hours ago
a day ago
days ago
Invalid characters found