TOPIC:

Usergroup or another DB data in a field 4 years 11 months ago #228940

  • Eddy.vh's Avatar
  • Eddy.vh
  • Offline
  • Platinum Member
  • Platinum Member
  • Registered
  • Posts: 1038
  • Thanks: 173
Mario.

Indeed, if I connect with your accesses, the query works.
I log in with my access, it returns an error. It should be able to work with any connected user.

Not easy

Please Log in or Create an account to join the conversation.

Usergroup or another DB data in a field 4 years 11 months ago #228941

  • MarioPuco's Avatar Topic Author
  • MarioPuco
  • Offline
  • Platinum Member
  • Platinum Member
  • Registered
  • Posts: 5957
  • Thanks: 558
Hi,

Please try this :
<?php 
$user = JFactory::getUser();
if ($user) {
$user_id = $user->id;
$db = JFactory::getDbo();
$db->setQuery("SELECT id FROM #__facileforms_records WHERE user_id = $user_id");
$record_id = $db->loadResult();
$date_of_birth = "";	
if ($record_id) {
$db->setQuery("SELECT value from #__facileforms_subrecords WHERE element = 4 AND record = $record_id");
$date_of_birth = $db->loadResult();
}

return $date_of_birth;
} 
return "";
?>

Regards,
Mario

Please Log in or Create an account to join the conversation.

Usergroup or another DB data in a field 4 years 11 months ago #228942

  • Eddy.vh's Avatar
  • Eddy.vh
  • Offline
  • Platinum Member
  • Platinum Member
  • Registered
  • Posts: 1038
  • Thanks: 173
Mario.

I think I understood.

Before writing the request, there was a registration of the form with your information. And the query reads and displays this stored information.

This is not the purpose of my request. I think we misunderstood.

I want, from the user ID, retrieved by
<? php $ user = JFactory :: getUser (); return "$ user-> id"; ?>
We were going to retrieve the date of birth value from the #__fields_values table and corresponding to the ID of the logged in user.

Attachments:

Please Log in or Create an account to join the conversation.

Usergroup or another DB data in a field 4 years 11 months ago #228954

  • MarioPuco's Avatar Topic Author
  • MarioPuco
  • Offline
  • Platinum Member
  • Platinum Member
  • Registered
  • Posts: 5957
  • Thanks: 558
Hi,

Okay I think I understood now.
Please try this, I think this is what you want :
<?php 
$user = JFactory::getUser();
if ($user) {
$user_id = $user->id;
$date_of_birth = "";	
$db = JFactory::getDbo();
$db->setQuery("SELECT value from #__fields_values WHERE item_id = $user_id");
$date_of_birth = $db->loadResult();
return $date_of_birth;
} 
return "";
?>

Regards,
Mario

Please Log in or Create an account to join the conversation.

Usergroup or another DB data in a field 4 years 11 months ago #228957

  • Eddy.vh's Avatar
  • Eddy.vh
  • Offline
  • Platinum Member
  • Platinum Member
  • Registered
  • Posts: 1038
  • Thanks: 173
Dear Mario.

I think we finally understood!
That's exactly what I'm looking for, now I also think I understand the query and can renew it with other database fields.

I thank you very much for your help and wish the whole team a great weekend.

Please Log in or Create an account to join the conversation.

Usergroup or another DB data in a field 4 years 11 months ago #228958

  • MarioPuco's Avatar Topic Author
  • MarioPuco
  • Offline
  • Platinum Member
  • Platinum Member
  • Registered
  • Posts: 5957
  • Thanks: 558
Hey,

I'm glad we solved it :)
If you have any other questions, let us know.

Regards,
Mario

Please Log in or Create an account to join the conversation.

Moderators: ForumSupport
Time to create page: 0.111 seconds

Support Chat

Join our Discord chat and enter the Crosstec channels for live-support, chat forums and interact directly with the community!

After joining, please enter the Crosstec Area and use the #crosstec-support or #crosstec-general channels.

Quick Links

Downloads

BreezingForms

ContentBuilder

BreezingCommerce

Templates

Documentation

BreezingForms

ContentBuilder

BreezingCommerce

Apprendre BreezingForms (French Community)

Apprendre et maîtriser BreezingForms par des tutoriels et exemples, le tout en français

breezingforms.eddy-vh.com

Questions et réponses sur les forums de l'AFUJ

AFUJ

Subscribe to news and updates!

Special Offer

Sale! All subscriptions at a special price!

Includes prio support, all of our current and future Joomla!® extensions and Joomla!® templates for the duration of your membership.

Get it from here

3rd Party Discount - 25% Off

We help you to keep your costs under control. If you are a new member and purchased a form building tool from a different form vendor, then you'll get a 25% discount on our subscription plans.

How to receive the discount:

Send us a quick email to sales@crosstec.org with a proof of purchase (for example a paypal receipt), await payment instructions and enjoy your membership!

Live Support Chat Opened!

Join our Discord chat here and enter the Crosstec channels to receive live support and talk directly to the team!