DMXzone Server Connect Support Product Page

Query Two Tables

Asked 03 May 2019 12:10:13
1
has this question
03 May 2019 12:10:13 Dan Everton posted:
Hi again Teodor

On the wedding site i am working on I have two tables...

"Couples" with it's own set of data customer data

and "CouplesGallery" which is an image gallery.

When logged in as a customer they can upload thier own images and their unique ID is added to the gallery table

You can also log in as an invited guest. They are served the relevant info for the wedding they are invited to from "Couples"

The problem is that I am not sure how to pull in the relevant image gallery.

You helped with the image display this morning which I am grateful for - if you could help with this small issue I can get the project signed off.

Many thanks
Dan

Replies

Replied 03 May 2019 12:51:17
03 May 2019 12:51:17 Teodor Kuduschiev replied:
Hello Dan,
I am not sure i understand how the tables are filtered, but why not send the couple gallery ID with this invite link as an url parameter? Then filter the database query using this query parameter and show the photos related to it.
Replied 03 May 2019 13:04:19
03 May 2019 13:04:19 Dan Everton replied:
Thanks for the reply.

I already filter the logged in page by "Couples"

So need to also filter the gallery so not sure how to filter two tables on the same page

Make sense?

There's also a third table to factor in on that page (guests to complete RSVP form which posts to a table but needs the couple ID too)

I really appreciate your quick feedback.

Regards
Replied 03 May 2019 13:08:03
03 May 2019 13:08:03 Teodor Kuduschiev replied:
I don't understand your question Dan.
If you want to send a link to a specific gallery, use the gallery ID in an URL parameter and filter the data source using this URL parameter. That's all ...
Replied 03 May 2019 13:12:24
03 May 2019 13:12:24 Dan Everton replied:
Let me try to clearer.

Page is filtered by logged in user (wedding guest)

They need to also view relevant images from Gallery (using Couple ID)

They also need to submit a RSVP to a table with hidden value of Couple ID

Is that clearer?

Do you want to chat?

Thanks
Dan
Replied 03 May 2019 13:30:01
03 May 2019 13:30:01 Dan Everton replied:
I don't want to LINK to the gallery - i want to include it on the same page
Replied 03 May 2019 13:38:33
03 May 2019 13:38:33 Dan Everton replied:
I know i can bind the main couple ID to the RSVP form in a hidden field

Really the only isse I am having is filtering the Gallery based on the Couple ID form the main DB

if we chat we can resolve it pretty quickly i am sure.

If i ping you a message will you reply?

Thanks
Dan
Replied 03 May 2019 13:48:58
03 May 2019 13:48:58 Teodor Kuduschiev replied:
Dan you are jumping from topic to topic. Please explain what you need to achieve (i don't need the exact name of the columns).
Not sure what RVSP are you even referring to and how is it related to the filtering of a database table.

I am not available on the chat. Ask your questions here please, just explain what you need to do.
Replied 03 May 2019 14:03:22
03 May 2019 14:03:22 Dan Everton replied:
Ok

Go to redhousebarn.co.uk/our-wedding/

login with:

tina-mark-04-01-2020

password is hidden as they are guests and so not need individual passwords.

SO

The main data on the page is filtered from the security provider and the table 'couples' on the ID column

I am currently not filtering the main image so i can see how it needs to be - but it needs to be filtered by the column CoupleID

this is set in admin when i add an image - it uses a hidden field with the correct value

So i need to add this filter on the page too.

When this is working i will apply the same to a full gallery

OK?
Replied 03 May 2019 14:28:39
03 May 2019 14:28:39 Teodor Kuduschiev replied:
Dan i really cannot get your idea.
What are you trying to filter with what value( where it comes from)? Is it the same server action file with two queries and the second one needs to be filtered by a value from the first, or do you need to filter it using an input on the page?
Replied 03 May 2019 14:57:13
03 May 2019 14:57:13 Dan Everton replied:
There are two tables

1) Couples - this houses most info on the couple getting married.

2) CoupleGallery - images added admin

the image add form sends the CoupleID for the main logged in couple

The page /our-wedding/access.php needs to show the main image form CoupleGallery with the same value (CoupleID) as the ID being set on Guest login

The server action MainImage needs to filter them both together.

I can't really explain it any better - hopefully we can resolve this

Thanks
Dan

Replied 03 May 2019 15:16:18
03 May 2019 15:16:18 Teodor Kuduschiev replied:
Sorry i still don't understand what are you trying to achieve.
Is it possible to not mention the exact table names/column names and just explain to me like:

"I have a server action with two database queries, i want to use a value from query one to filter the value in query two... etc."

I don't really need to know what your column/table/database names are. I need to understand what value, coming from where needs to be used where to filter what.
Replied 03 May 2019 15:20:55
03 May 2019 15:20:55 Dan Everton replied:
Exactly -

I have a server action with two database queries, i want to use a value from query one to filter the value in query two.

That's it

: )
Replied 03 May 2019 15:45:36
03 May 2019 15:45:36 Teodor Kuduschiev replied:
Well Dan, in query two use this as a value for the filter:

query1[0].columnName
where query1 is the name of your first query and columnName is the name of the database column which value you want to use.

Reply to this topic