close ad
Databridge V2 with MySQLi support IS Now Available!
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

DataAssist Pages wizard does not write the correct query code, "ambiguous error".

Thread began 11/07/2018 6:57 pm by Jonas | Last modified 4/16/2019 11:55 am by Jonas | 181 views | 22 replies

Justin@AdventDesign

Sorry to loop back here but I'm still unable to resolve the 'ambiguous' error after the WHERE clause...

1) I've tried inserting "tbl_homes.id" and "tbl_homes.id AS id" in place of one or both of the instances where it shows "id" in the relevant WADbSearch code and I still get the same ambiguous "id" in WHERE clause error.

2) I still don't understand where this WHERE clause is coming from or why it is there... I'm not running any search query, just loading the page raw as is. There shouldn't be any values in the search variables and I have no idea where it is getting the values for those variables.

This is the pertinent code I believe:

<?php
$searchWADAtbl_homes_WADbSearch1 = new WA_MySQLi_Search("WADAtbl_homes","");
if (isset($_GET["Search"]) || isset($_GET["Search_x"])) {
$searchWADAtbl_homes_WADbSearch1->clearSearch();
$searchWADAtbl_homes_WADbSearch1->setSearch(array("type"=>"Edit", "comparison"=>"=", "join"=>"AND"), array("id"), "d", "id");
$searchWADAtbl_homes_WADbSearch1->setSearch(array("type"=>"Edit", "comparison"=>"Includes", "join"=>"AND"), array("skunumber"), "s", "skunumber");
$searchWADAtbl_homes_WADbSearch1->setSearch(array("type"=>"Edit", "comparison"=>"Includes", "join"=>"AND"), array("title"), "s", "title");
$searchWADAtbl_homes_WADbSearch1->setSearch(array("type"=>"Edit", "comparison"=>"=", "join"=>"AND"), array("type"), "d", "type");
$searchWADAtbl_homes_WADbSearch1->setSearch(array("type"=>"Edit", "comparison"=>"=", "join"=>"AND"), array("category"), "d", "category");
$searchWADAtbl_homes_WADbSearch1->setSearch(array("type"=>"Edit", "comparison"=>"=", "join"=>"AND"), array("subcategory"), "d", "subcategory");
$searchWADAtbl_homes_WADbSearch1->setSearch(array("type"=>"Edit", "comparison"=>"=", "join"=>"AND"), array("community"), "d", "community");
$searchWADAtbl_homes_WADbSearch1->setSearch(array("type"=>"Edit", "comparison"=>"=", "join"=>"AND"), array("featured"), "d", "featured");
$searchWADAtbl_homes_WADbSearch1->setSearch(array("type"=>"Edit", "comparison"=>"=", "join"=>"AND"), array("new"), "d", "new");
$searchWADAtbl_homes_WADbSearch1->setSearch(array("type"=>"Edit", "comparison"=>"=", "join"=>"AND"), array("pricemin"), "d", "pricemin");
$searchWADAtbl_homes_WADbSearch1->setSearch(array("type"=>"Edit", "comparison"=>"=", "join"=>"AND"), array("pricemax"), "d", "pricemax");
$searchWADAtbl_homes_WADbSearch1->setSearch(array("type"=>"Edit", "comparison"=>"=", "join"=>"AND"), array("beds"), "d", "beds");
$searchWADAtbl_homes_WADbSearch1->setSearch(array("type"=>"Edit", "comparison"=>"=", "join"=>"AND"), array("baths"), "d", "baths");
$searchWADAtbl_homes_WADbSearch1->setSearch(array("type"=>"Edit", "comparison"=>"=", "join"=>"AND"), array("garagemin"), "d", "garagemin");
$searchWADAtbl_homes_WADbSearch1->setSearch(array("type"=>"Edit", "comparison"=>"=", "join"=>"AND"), array("garagemax"), "d", "garagemax");
$searchWADAtbl_homes_WADbSearch1->setSearch(array("type"=>"Edit", "comparison"=>">=", "join"=>"AND"), array("sqft"), "d", "sqft");
$searchWADAtbl_homes_WADbSearch1->setSearch(array("type"=>"Edit", "comparison"=>"<=", "join"=>"AND"), array("sqft"), "d", "sqft");
$searchWADAtbl_homes_WADbSearch1->setSearch(array("type"=>"Edit", "comparison"=>"=", "join"=>"AND"), array("publish"), "d", "publish");
}
?>
<?php
$WADAtbl_homes = new WA_MySQLi_RS("WADAtbl_homes",$framework_connect,1000);
$WADAtbl_homes->setQuery("SELECT tbl_homes.id, tbl_homes.title, `sl_types`.`title` AS sl_types_title, `sl_categories`.`title` AS sl_categories_title, tbl_homes.sqft, tbl_homes.beds, tbl_homes.baths, tbl_homes.featured, tbl_homes.dateupdate, `sl_publish`.`title` AS sl_publish_title FROM tbl_homes LEFT JOIN sl_types ON sl_types.id = tbl_homes.type LEFT JOIN sl_categories ON sl_categories.id = tbl_homes.category LEFT JOIN sl_publish ON sl_publish.id = tbl_homes.publish");
$WADAtbl_homes->execute();
?>

As you can see, I've added the table prefixes where appropriate.

This is what is being returned in the browser with the bizzare WHERE stuff...

SELECT SQL_CALC_FOUND_ROWS tbl_homes.id AS id, tbl_homes.title AS title, `sl_types`.`title` AS sl_types_title, `sl_categories`.`title` AS sl_categories_title, tbl_homes.sqft AS sqft, tbl_homes.beds AS beds, tbl_homes.baths AS baths, tbl_homes.featured AS featured, tbl_homes.dateupdate AS dateupdate, `sl_publish`.`title` AS sl_publish_title FROM tbl_homes LEFT JOIN sl_types ON sl_types.id = tbl_homes.type LEFT JOIN sl_categories ON sl_categories.id = tbl_homes.category LEFT JOIN sl_publish ON sl_publish.id = tbl_homes.publish WHERE ((`id` = 1) and (`type` = 4) and (`category` = 7) and (`subcategory` = 1) and (`community` = 1) and (`beds` = 1) and (`baths` = 1) and (`garagemin` = 0) and (`garagemax` = 0) and (`publish` = 1)) LIMIT 1000

Column 'id' in where clause is ambiguous

If I remove the search WADA code containing the search arrays, the page displays as expected.

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...