- Posts: 2
- Thank you received: 0
OSMembershipHelper::getActiveMembershipPlans() returning array (0, 1)
- Robert Gaunt
- Topic Author
- Offline
- New Member
-
Less
More
2 years 3 months ago #155933
by Robert Gaunt
OSMembershipHelper::getActiveMembershipPlans() returning array (0, 1) was created by Robert Gaunt
When calling getActiveMembershipPlans, the returns the following: Array
(
[0] => 0
[1] => 1
)plan_id 0 doesn't exist,
plan_id 1 is valid for this user
Any particular reason for this?
Thanks,
Rob
(
[0] => 0
[1] => 1
)plan_id 0 doesn't exist,
plan_id 1 is valid for this user
Any particular reason for this?
Thanks,
Rob
Please Log in or Create an account to join the conversation.
- Tuan Pham Ngoc
- Offline
- Administrator
-
2 years 3 months ago #155935
by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic OSMembershipHelper::getActiveMembershipPlans() returning array (0, 1)
Hi Robert
Honestly, that was from long time ago, so I don't remember exactly the reason I have it programmed like that
The first element of the array is always 0, to make sure the returned array always contains at least one element. That is to prevent SQL error when we use that data in SQL command
Regards,
Tuan
Honestly, that was from long time ago, so I don't remember exactly the reason I have it programmed like that
The first element of the array is always 0, to make sure the returned array always contains at least one element. That is to prevent SQL error when we use that data in SQL command
Regards,
Tuan
Please Log in or Create an account to join the conversation.
- Robert Gaunt
- Topic Author
- Offline
- New Member
-
Less
More
- Posts: 2
- Thank you received: 0
2 years 3 months ago #155945
by Robert Gaunt
Replied by Robert Gaunt on topic OSMembershipHelper::getActiveMembershipPlans() returning array (0, 1)
Thanks for the prompt answer Tuan - as always.
I have come across similar things in Joomla - preventing a SQL error sounds about right.
getPlan plan_id=0 just returns $planId=0 anyway (or unset does it for me)
Thanks,
Rob
I have come across similar things in Joomla - preventing a SQL error sounds about right.
getPlan plan_id=0 just returns $planId=0 anyway (or unset does it for me)
Thanks,
Rob
Please Log in or Create an account to join the conversation.
Support
Documentation
Information
Copyright © 2025 Joomla Extensions by Joomdonation. All Rights Reserved.
joomdonation.com is not affiliated with or endorsed by the Joomla! Project or Open Source Matters.
The Joomla! name and logo is used under a limited license granted by Open Source Matters the trademark holder in the United States and other countries.
The Joomla! name and logo is used under a limited license granted by Open Source Matters the trademark holder in the United States and other countries.