SQL

QuestionsSQL
Massimo asked 8 years ago

Hello,
i bought yesterday the full version of script and i cannot understand how use custom query.
This is my code:
http://pastebin.com/qZjrQ6Y8
In this case how show in column grid the field CodUtenzaDispositivo of ht_ass_h_garbage table joined with the ht_ass_garbage?

I tried:
$col = array();
$col["title"] = "ht_ass_aer"; // caption of column, can use HTML tags too
$col["name"] = "ht_ass_h_aer.CodUtenzaDispositivo"; // grid column name, same as db field or alias from sql
$col["search"] = false; // this column is not searchable
$col["width"] = "25"; // width on grid

$cols[] = $col;

(see pastebin code) but dont work.

Can you please, help me?
Thanks.
Massimo

6 Answers
Massimo answered 8 years ago

… sorry,
In this case how show in column grid the field CodUtenzaDispositivo of ht_ass_h_aer table joined with the ht_ass_garbage?

Abu Ghufran answered 8 years ago

If you query is correct and work on database (test with phpmyadmin), then you need to set:

$col["name"] = "CodUtenzaDispositivo"; // (without table name)

$col = array();
$col["title"] = "ht_ass_aer"; // caption of column, can use HTML tags too
$col["name"] = "CodUtenzaDispositivo"; // grid column name, same as db field or alias from sql
$col["search"] = false; // this column is not searchable
$col["width"] = "25"; // width on grid

Massimo answered 8 years ago

Yes, the query work correctly and the the field CodUtenzaDispositivo is ambiguus because is present in two tables (ht_ass_garbage and ht_ass_h_aer).

Abu Ghufran answered 8 years ago

For displaying in grid, you need to set just:
$col["name"] = "CodUtenzaDispositivo";

ok, It will be required in searching.
You need to set:
$col["dbname"] = "ht_ass_garbage.CodUtenzaDispositivo";

Massimo answered 8 years ago

Ok, another step please.
I see custom query work with primary key named "id" but in my database the primary key is named "Seriale" (and i cannot modify). How can i set the correct pk ?

Massimo answered 8 years ago

Solved

Your Answer

3 + 6 =

Login with your Social Id:

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.



How useful was this discussion?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate it.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?