TOPIC:

Populate Field with Data from DB 4 weeks 1 day ago #267232

  • Topic Author
  • papin0
  • Offline
  • Expert Breezer
  • Expert Breezer
  • Posts: 208
  • Thanks: 0
My code is working but it only bring the data of one user instead of the login user
//Get Badge Number
$this->execPieceByName('ff_InitLib');
$db = JFactory::getDBO();
$userid = JFactory::getUser()->id;
$db->setQuery('SELECT value FROM #__fields_values WHERE field_id=1');
$result = $db->loadResult();
ff_setValue('badge', $result);

TIA

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

Populate Field with Data from DB 4 weeks 1 day ago #267233

  • Mirec's Avatar
  • Mirec
  • Offline
  • Ultimate Breezer
  • Ultimate Breezer
  • Posts: 1547
  • Karma: 2
  • Thanks: 81
Hi,

try like this
//Get Badge Number
$this->execPieceByName('ff_InitLib');
$db = JFactory::getDBO();
$userid = JFactory::getUser()->id;
$db->setQuery('SELECT * FROM #__fields_values
INNER JOIN #__users on #__fields_values.field_id=#__users.id
WHERE #__users.id='.$userid);
$result = $db->loadResult();
ff_setValue('badge', $result);

Let me know the result!
Regards,
Mirko

Attachments:

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

Populate Field with Data from DB 4 weeks 23 hours ago #267234

  • Topic Author
  • papin0
  • Offline
  • Expert Breezer
  • Expert Breezer
  • Posts: 208
  • Thanks: 0
Is not working,
I need to pull the user's badge number

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

Last edit: Post by papin0.

Populate Field with Data from DB 4 weeks 15 hours ago #267243

  • Mirec's Avatar
  • Mirec
  • Offline
  • Ultimate Breezer
  • Ultimate Breezer
  • Posts: 1547
  • Karma: 2
  • Thanks: 81
Hi,

based on the code that you provided here, and you want to get info in table "__fields_values" based on logged user, for that, we need to connect table where users are stored," _users" with "__fields_values".

I really do not know why my example does didn't work, it should be great if you can send me database access info and backend link, that I can make some tests, on email ma@evolutio.hr

Did you get any errors?

Regards,
Mirko

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

Last edit: Post by Mirec.

Populate Field with Data from DB 4 weeks 8 hours ago #267258

  • Topic Author
  • papin0
  • Offline
  • Expert Breezer
  • Expert Breezer
  • Posts: 208
  • Thanks: 0
I need to get the badge value not the user id
like here I get the Badge value but not for the logging user

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

Last edit: Post by papin0.

Populate Field with Data from DB 4 weeks 8 hours ago #267259

  • Topic Author
  • papin0
  • Offline
  • Expert Breezer
  • Expert Breezer
  • Posts: 208
  • Thanks: 0
This message contains confidential information

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

  • Page:
  • 1
  • 2
Moderators: ForumSupport
Time to create page: 0.094 seconds

BreezingForms Pro 1.4.7 for WordPress Released!

Available in the membership section.

September Discount!

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!