• 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!

TOPIC: Php Variables as Default

Php Variables as Default 8 years 5 months ago #35998

  • paul8
  • paul8's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 2
Hi

I have been at this for a while and have done all the reading I can but I cant get this to work.
I am pretty sure it is close so any help much appreciated.

I run the following sql from my database and it returns the info I require.

SELECT FieldValue FROM pzimy_rsform_submission_values WHERE FieldName = 'surname' AND SubmissionValueId = (select SubmissionId FROM pzimy_rsform_submissions WHERE UserId = '863' AND FormId = '4');


So I put this into the default value for a text field like this
//<code>
$db = JFactory::getDbo();
$db->setQuery("SELECT FieldValue FROM pzimy_rsform_submission_values WHERE FieldName = 'surname' AND SubmissionId = (select SubmissionId FROM pzimy_rsform_submissions WHERE UserId = '863' AND FormId = '4')";
return $db->loadResult();
//</code>

This returns nothing? Not sure what bis wrong but hoping it is close and possible.

Also wanting to use this for the UserId
JFactory::getUser()->id
will this return me the userid of the logged in user and just place it where I have 863? does it need leading . like this
.JFactory::getUser()->id.

Any assistance much appreciated
Paul
The administrator has disabled public write access.
  • 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!