Search not Working as Expected

QuestionsSearch not Working as Expected
Tony Wolsey asked 5 years ago

Hello

I cannot get search to work on fields that are connected via MySQL Inner Join statement.  This is referring to the individual column search and the overall search.  I receive either an error that the field cannot be found or that the column in the Where clause is ambiguous.

The column search works only for columns that are part of the referenced table. See below.

Here is the SQL statement.

$g->select_command = “SELECT s.id, s.inputtags, s.interlock, s.statusin, s.outputtag, s.statusop, s.failposition, s.sdaction1, s.sdaction2, s.timedelay, s.remarks, s.notes, s.inputrev, s.outputrev, i.sdkitemnoinput, i.servicedescription, i.pid, o.sdkitemnooutput, o.servicedescription as opservicedescription, o.pid as oppid, Left(s.inputtags,2) as testcolumn
FROM tblsdkrelation s

INNER join tblindex i on s.inputtags = i.tag
INNER join tblindex o on s.outputtag = o.tag
“;

// this db table will be used for add,edit,delete
$g->table = “tblsdkrelation”;

thank you

Tony

2 Answers
Abu Ghufran Staff answered 5 years ago

Hello,

You need to use dbname property of column to resolve ambiguity: e.g. i.servicedescription

$col[“name”] = “servicedescription”;
$col[“dbname”] = “i.servicedescription”; // table.field style

 

_________________________
Abu Ghufran - Dev Team
Grid 4 PHP Framework
 
Tony Wolsey answered 5 years ago

That is brilliant Abu. Thank you so much!

 

Your Answer

8 + 0 =

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?