Home News Contact Us Forum About Us Demos Products F.A.Q.
Shopping Cart
You currently have 0 items in your cart.


Recent Events
  • 31/12/2023 New Year SALE

    We are glad to announce New Year SALE. 25% discount for all our extensions. Use NY24 coupon code. Hurry up the discount is valid till 7 January.

  • 21/11/2023 BLACK FRIDAY 23 is coming

    BIG SALE, 35% discount for all our extensions. Use BF23 coupon code. Hurry up the discount is valid till 27 November.


2Checkout.com, Inc. is an authorized retailer of goods and services provided by ARI Soft. 2CheckOut




Follow us on twitter



Welcome, Guest
Please Login or Register.    Lost Password?

Extract data based on user ID
(1 viewing) (1) Guest
Go to bottomPage: 1
TOPIC: Extract data based on user ID
#20451
Extract data based on user ID 12 Years, 7 Months ago Karma: 0
Hi,

I want to show data to the logged user.

These tabels i have:

tabel_content:
tabel_content.created_by (here is stored the Joomla user ID)
tabel_content.id (here is stored the listing number)

tabel_listings
tabel_listings.listing_id (here is stored the listing number)
tabel_listings.item1
tabel_listings.item2
tabel_listings.item3

When i use:

SELECT
tabel_listings.item1
tabel_listings.item2
tabel_listings.item3
FROM
tabel_listings

...it shows ALL available data. I want only show the data which belongs to the logged user. Somehow it has to:

1: match the Joomla user ID with tabel_content.created_by
2: find the corresponding tabel_content.id
3: use this tabel_content.id to find the tabel_listings.listing_id
4: show the items for the found tabel_listings.listing_id

Can this be done?
The administrator has disabled public write access.
 
#20452
Re:Extract data based on user ID 12 Years, 7 Months ago Karma: 748
Hello,

Use the next SQL query:

Code:


SELECT
  L.item1
  L.item2
  L.item3
FROM
  tabel_listings L INNER JOIN tabel_content C
    ON L.listing_id = C.id
WHERE
  C.id = {$UserId}



Regards,
ARI Soft
The administrator has disabled public write access.
 
#20457
Re:Extract data based on user ID 12 Years, 7 Months ago Karma: 0
Thanks! done.
The administrator has disabled public write access.
 
Go to topPage: 1