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?

How to use Joomla User ID in SQL Query
(1 viewing) (1) Guest
Go to bottomPage: 1
TOPIC: How to use Joomla User ID in SQL Query
#68142
How to use Joomla User ID in SQL Query 3 Years, 2 Months ago Karma: 0
Hi

I am still new working with Joomla, and love your extension's DataTables. I have the following DB Query which works, but I am trying to make it dynamic to the current user:

SELECT
kech_Facility,
kech_tag

FROM `KE_db1` as k INNER JOIN track_db2 as tr on k.kech_Group=tr.hsj_hs_Name where tr.hsi_j_key=923 and kech_Facility is not null order by kech_Facility asc, kech_Location asc


in the query the part tr.hsi_j_key =923 uses the joomla id (in this case hardcoded to 923)

Any help would be greatly appreciated

Craig
The administrator has disabled public write access.
 
#68144
Re:How to use Joomla User ID in SQL Query 3 Years, 2 Months ago Karma: 760
Hello,

Use {$UserId} predefined variable:

Code:


SELECT 
kech_Facility, 
kech_tag

FROM `KE_db1` as k INNER JOIN track_db2 as tr on k.kech_Group=tr.hsj_hs_Name where tr.hsi_j_key={$UserId} and kech_Facility is not null order by kech_Facility asc, kech_Location asc



Regards,
ARI Soft
The administrator has disabled public write access.
 
#68145
Re:How to use Joomla User ID in SQL Query 3 Years, 2 Months ago Karma: 0
Thanks so much. Worked exactly right
The administrator has disabled public write access.
 
Go to topPage: 1