close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Column 'county' in where clause is ambiguous - error when adding 'DataAssist Search Behaviour'

Thread began 1/19/2017 8:20 am by s.joiner74419001 | Last modified 7/18/2017 7:54 am by Ray Borduin | 2758 views | 6 replies |

s.joiner74419001

Column 'county' in where clause is ambiguous - error when adding 'DataAssist Search Behaviour'

I a trying to manually add a 'DataAssist Search Behaviour' to a page but I am getting this error when I have added it.

'Column 'county' in where clause is ambiguous'

I am hoping to eventually have 3 filter options which will be - "View By - 'county' , 'agent' and 'All'.
But for now I just want to get the first filter working form the 'county' column in the recordset.

Page attached... Thanks in advance.

Attached Files
right-to-manage-success-t.php
Sign in to reply to this post

s.joiner74419001

OK so I have just realised that the problem lied with the two tables ( properties, agents ) being used in the recordset both have a column named 'county'. So I changed the 'county' column in the 'agents' table to 'county_a'. which solved the error.

What I don't understand is the 'county' column from the 'agents' table wasn't being selected in the recordSet. as below -

mysql_select_db($database_Testing_server, $Testing_server);
$query_rsRTMs = "SELECT properties.property_id, properties.property_name, properties.address, properties.town_city, properties.county, properties.`size`, properties.type, properties.acquisition, properties.image, properties.agent_id, properties.alt_tag, properties.title_tag, agents.agent_id, agents.name, agents.url FROM properties, agents WHERE properties.agent_id = agents.agent_id ORDER BY properties.acquisition ASC";
setQueryBuilderSource($query_rsRTMs,$WADbSearch1,false);
$rsRTMs = mysql_query($query_rsRTMs, $Testing_server) or die(mysql_error());
$row_rsRTMs = mysql_fetch_assoc($rsRTMs);
$totalRows_rsRTMs = mysql_num_rows($rsRTMs);

So how is it appearing in the column list from the filter options?

Filter is now working. using the following repeat region to filter the 'county' column.

// RepeatSelectionCounter_2 Begin Loop
$RepeatSelectionCounter_2_IterationsRemaining = $RepeatSelectionCounter_2_Iterations;
while($RepeatSelectionCounter_2_IterationsRemaining--){
if($RepeatSelectionCounterBasedLooping_2 || $row_rsCounty){
?>
<li><a href="right-to-manage-success-t.php?county=<?php echo $row_rsCounty['county']; ?>"><?php echo $row_rsCounty['county']; ?></a></li>
<?php
} // RepeatSelectionCounter_2 Begin Alternate Content
else{
?>
<?php } // RepeatSelectionCounter_2 End Alternate Content
if(!$RepeatSelectionCounterBasedLooping_2 && $RepeatSelectionCounter_2_IterationsRemaining != 0){
if(!$row_rsCounty && $RepeatSelectionCounter_2_Iterations == -1){$RepeatSelectionCounter_2_IterationsRemaining = 0;}
$row_rsCounty = mysql_fetch_assoc($rsCounty);
}
$RepeatSelectionCounter_2++;
} // RepeatSelectionCounter_2 End Loop
?>

I now want to use a second repeat region to filter the 'agents' column.

I think I need to hand code this just not sure how.

Current page attached

Thanks in advance.

Attached Files
right-to-manage-success-t.php
Sign in to reply to this post

s.joiner74419001

OK So I figured out how to add the second filter using a second trigger by referring another project using a similar technique and manually updating the trigger code as follows.

if (isset($_GET['county']) || isset($_GET['agent'])) {
.......
}

What I need now is for the page to show all by default or once a filter has been selected to be able to revert back to 'view all'

I have a button on the page such as:

<a href="right-to-manage-success-t.php" role="button"> View All </a>

But I'm not sure how I can add a parameter to this and then add a third filter to the search behaviour for this to work.

Sign in to reply to this post

Ray BorduinWebAssist

You just have to re-trigger the search, so I think this would work:


<a href="right-to-manage-success-t.php?agent=" role="button"> View All </a>

Sign in to reply to this post
Did this help? Tips are appreciated...

s.joiner74419001

Ray, I now have the same 'show all' issue with another page using a similar search function. I have tried to adapt the same solution to 're-trigger the search' but this time it is not working properly. I am not having a 'View All' button but I need the same function when someone is directed to the page from the main nav-bar.
I've attached the page. You can also view it from the link in private section.

Attached Files
right-to-manage-testimonials.php
Sign in to reply to this post

Ray BorduinWebAssist

It appears to be working. What steps should I be following to see the problem? How can I tell it is or isn't working properly?

Sign in to reply to this post
Did this help? Tips are appreciated...

s.joiner74419001

Sorry Ray, Ive just realised my mistake on the Query. I had a RIGHT JOIN with counties instead of LEFT JOIN so it was repeating the region for all counties and not just for counties that matched with testimonials.

All working now.. Apologies.

Sign in to reply to this post

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...