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


Recent Events
  • 23/11/2024 Black Friday 2024

    BIG SALE, 30% discount for all our extensions. Use BF24 coupon code. Hurry up the discount is valid till 3 December.

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


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?

filtering by joomla userid
(1 viewing) (1) Guest
Go to bottomPage: 1
TOPIC: filtering by joomla userid
#23479
filtering by joomla userid 12 Years, 10 Months ago Karma: 0
Hi,
I need to filter my history table with the joomla userid which is currently logged in and have tried various configurations but not getting any data displayed. My sql statement is:
SELECT *
FROM `history`
WHERE `clientid` = '$UserId'

I'm expecting this to display ALL the rows of data where the history table clientid = the logged in user.

If I hardcode the sql to my id, then I can see all my data, but can't get the variable $UserID to filter anything
please help
The administrator has disabled public write access.
 
#23481
Re:filtering by joomla userid 12 Years, 10 Months ago Karma: 760
Hello,

Use the next SQL query:

Code:


SELECT
 *
FROM 
 `history`
WHERE 
 `clientid` = {$UserId}



Regards,
ARI Soft
The administrator has disabled public write access.
 
#23482
Re:filtering by joomla userid 12 Years, 10 Months ago Karma: 0
Thanks, but I did try that and still get "no data available" so this does not seem to help
My DB type is set to Joomla! DB, and although I get all my history information when I put clientID = Ant101 (my username) the history table is infact not part of the jooml! Db but is a table on the localhost on a different DB, but it seems to query it just fine when retrieving all the history data. I can't confirm if the $userID is actually being queried correctly to the joomla db ? It seems this is when the problem is?
The administrator has disabled public write access.
 
#23483
Re:filtering by joomla userid 12 Years, 10 Months ago Karma: 760
{$UserId} parameter contains a user ID (it is an integer value). If you want to use login, use {$UserLogin} predefined variable. Query will look like:

Code:


SELECT
 *
FROM 
 `history`
WHERE 
 `clientid` = {$UserLogin}



Regards,
ARI Soft
The administrator has disabled public write access.
 
#23484
Re:filtering by joomla userid 12 Years, 10 Months ago Karma: 0
Fantastic, thank you very much this works correctly now !
The administrator has disabled public write access.
 
Go to topPage: 1