• 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: Calculations from external database

Calculations from external database 5 years 7 months ago #38473

Hi All,

I have been racking my brain for days trying to find a solution, so hopefully someone can point me in the right direction.

I have mysql database in which there are columns with values.
in said database i have created a new column with the prefix needed for the calcs: [p123]

this is then pulled into a dropdown with the following PHP:

//<code>
$option = array();
$option = 'mysqli';
$option = 'xxx';
$option = 'xxx;
$option = 'xxx';
$option = 'db1';
$option = '';
$db = JDatabase::getInstance( $option );
$query = $db->getQuery(true);
$query = "SELECT column1, column2 FROM table1";
$db->setQuery($query);
$results = $db->loadObjectList();
foreach ($results as $result) {
$value = $result->column2;
$label = $result->column1;
$items[] = $value.'|'.$label;
}

$items = implode("\n", $items);
return $items;
//</code>

i then have another dropdown with the same PHP for the other part of the calc, i also have a textbox to show the value.

i then go to calculations and select cost = {dropdown1:value} - {dropdown2:value}

this in theory should work! But it shows a random number in the front end.

i would like to be able to select either A, B, Cor D from dropdown1 and the same for dropdown2 and for the calc to be done.

How would this be done?

Cheers

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