TOPIC:

Usergroup or another DB data in a field 2 years 1 month ago #228940

  • Eddy.vh's Avatar
  • Eddy.vh
  • Offline
  • Gold Breezer
  • Gold Breezer
  • Posts: 383
  • Karma: 4
  • Thanks: 62
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 2 years 1 month ago #228941

  • MarioPuco's Avatar Topic Author
  • MarioPuco
  • Offline
  • Ultimate Breezer
  • Ultimate Breezer
  • Posts: 5958
  • Karma: 119
  • Thanks: 554
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 2 years 1 month ago #228942

  • Eddy.vh's Avatar
  • Eddy.vh
  • Offline
  • Gold Breezer
  • Gold Breezer
  • Posts: 383
  • Karma: 4
  • Thanks: 62
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 2 years 1 month ago #228954

  • MarioPuco's Avatar Topic Author
  • MarioPuco
  • Offline
  • Ultimate Breezer
  • Ultimate Breezer
  • Posts: 5958
  • Karma: 119
  • Thanks: 554
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 2 years 1 month ago #228957

  • Eddy.vh's Avatar
  • Eddy.vh
  • Offline
  • Gold Breezer
  • Gold Breezer
  • Posts: 383
  • Karma: 4
  • Thanks: 62
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 2 years 1 month ago #228958

  • MarioPuco's Avatar Topic Author
  • MarioPuco
  • Offline
  • Ultimate Breezer
  • Ultimate Breezer
  • Posts: 5958
  • Karma: 119
  • Thanks: 554
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.109 seconds

BreezingForms Pro 1.4.7 for WordPress Released!

Available in the membership section.

Summer Sale!

Massive discounts on all subscriptions!

Get Your Subscription Here

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

Special Offer

Summer 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!