Search code examples
jqueryjquery-jtable

jquery-jtable: how to avoid this field is ambiguous in the db query?


I am using jquery jtable and one of my field names is considered ambiguous at the mysql layer. I was using a str_replace normalizer step so i could add a table namespace there. but i wonder if there is a better way.

jtable snippet

uid: {
 ...
}

ajax snippet

$sort = str_replace('uid', 'p.uid', $sort);  // this adds the p. table namespace
$query = "select ..... {$sort}";

Solution

  • just found a way to do this without the ajax step. ends up by putting the field name in quotes i could just add the table namespace directly to the jtable description.

    thought it may help someone else...

    i changed the jtable code from:

    uid: {
     ...
    }
    

    to

    "p.uid": {
     ...
    }