• 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: Script called on form process

Script called on form process 3 years 1 month ago #41940

  • jason425
  • jason425's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 6
  • Thank you received: 1
I can't figure this out would anybody please mind giving me a hand.

I have a form that has one input box "UserBETA_id"

When they submit the form I then have: Script called on form process
// Get a database connection
$db    = JFactory::getDBO();
// Get the current logged-in user's data
$user  = JFactory::getUser();
 
$db->setQuery("UPDATE #__comprofiler SET cb_betaid = '".$db->escape($_POST['form']['UserBETA_id'])."' WHERE user_id = '".$db->escape($user->id)."'");
$db->setQuery("SELECT * FROM beta_code_available WHERE beta_code = '".$_POST['form']['UserBETA_id']."'");
return $db->loadResult();
$db->setQuery("UPDATE #__comprofiler SET cb_betatype = '".$db->loadResult(['notes'])."' WHERE user_id = '".$db->escape($user->id)."'");
// Execute it.
$db->query();

Inside my table "beta_code_available" I have several fields "beta_code" "notes" and "duration"

On this line::
$db->setQuery("UPDATE #__comprofiler SET cb_betatype = '".?????."' WHERE user_id = '".$db->escape($user->id)."'");

What do I add where the ????? are so that it gets the data from $db->setQuery("SELECT * FROM ....."); where "notes"
The administrator has disabled public write access.

Script called on form process 3 years 1 month ago #41961

  • jason425
  • jason425's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 6
  • Thank you received: 1
I figured this out.
The administrator has disabled public write access.

Script called on form process 3 years 4 weeks ago #41966

  • gregs
  • gregs's Avatar
  • OFFLINE
  • Expert Boarder
  • Posts: 85
  • Thank you received: 5
Can you provide your solution so we all might benefit? Thanks.
The administrator has disabled public write access.

Script called on form process 3 years 4 weeks ago #41968

  • jason425
  • jason425's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 6
  • Thank you received: 1
gregs wrote:
Can you provide your solution so we all might benefit? Thanks.

Probably the wrong way to do it, sure there are way better solutions but hey it works for me.
// Get a database connection
$db    = JFactory::getDBO();
// Get the current logged-in user's data
$user  = JFactory::getUser();
 
$db->setQuery("SELECT code_type FROM beta_user WHERE beta_code = '".$_POST['form']['UserBETA_id']."'");
$result = $db->loadResult();
$db->setQuery("SELECT location FROM beta_user WHERE beta_code = '".$_POST['form']['UserBETA_id']."'");
$result1 = $db->loadResult();
 
$db->setQuery("UPDATE #__comprofiler SET cb_beta_id = '".$db->escape($_POST['form']['UserBETA_id'])."', cb_beta_code_type = '".$result."', cb_beta_location = '".$result1."'  WHERE user_id = '".$db->escape($user->id)."'");
// Execute it.
$db->query();

Make sure to pay attention to the $results and $results1
The administrator has disabled public write access.
The following user(s) said Thank You: gregs
  • 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!