TOPIC:

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

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

This is possible since in element VALUE input you can add PHP that will get rendered on page load :
<?php 
$db = JFactory::getDbo(); $db->setQuery("Select Max(id) From #__facileforms_records"); 
$next_record_id = intval($db->loadResult()); 
return $next_record_id;  
?>

So simply add this to the VALUE field and you will get your record ID.

Hope this helps.

Regards,
Mario

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

Last edit: Post by MarioPuco.

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

  • Eddy.vh's Avatar
  • Eddy.vh
  • Away
  • Platinum Member
  • Platinum Member
  • Registered
  • Posts: 1033
  • Thanks: 173
Hello Mario.

I do not think that's what I'm looking for.
I would, for example, pre-fill a field with user information stored in the database. eg the user's group (Super user, guest, etc.) or a birth date stored in a database table.
How do I structure the php query to access database information for a user?

PS, I'm not a programmer, a detailed explanation would be appreciated.

Thank you for the attention and your help.

Regards

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

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

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

I gave you an example for getting last record ID which was more of a template code rather than the solution.
In my code example above I was getting Select Max(id) From #__facileforms_records

For example if you want to get registerDate of your user the query would look like this :
<?php 
$db = JFactory::getDbo(); $db->setQuery("Select Max(registerDate) From #__users"); 
$next_record_id = $db->loadResult(); 
return $next_record_id;  
?>

You can learn more how to query the DB on this link : www.w3schools.com/sql/sql_create_db.asp

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 #228850

  • Eddy.vh's Avatar
  • Eddy.vh
  • Away
  • Platinum Member
  • Platinum Member
  • Registered
  • Posts: 1033
  • Thanks: 173
Mario.

I understood that I could select a data in a user table.

Let's take a concrete example:
I have a user "User1", his user ID is 56, he has entered his date of birth in a custom field "DateOfBirth", available in his profile.
How to retrieve the "DateOfBirth" information, which is in a table other than User, in a text field of the form.

Sorry to insist and thank you very much for the help.

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

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

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

I'm afraid it does not work that way Eddy, it would be too much 'stabs in the dark' to write this query without access to your phpmyadmin.

If you can share access to your phpmyadmin I could write THIS query for you.
You can send your info to support@crosstec.org and I will get back to you ASAP.

Regards,
Mario

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

Usergroup or another DB data in a field 4 years 10 months ago #228887

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

The necessary information is sent by email.
I thank you very much for this precious help.

Regards

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

Moderators: ForumSupport
Time to create page: 0.059 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!