vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   Currency exchange (https://vborg.vbsupport.ru/showthread.php?t=274293)

iogames 11-19-2011 02:53 PM

Currency exchange
 
Hi...

I placed a currency exchange by google to automatically check the exchange rate for the euro, everything works Ok, but I've been struggling to add an operation to the code...

PHP Code:

<?php
require_once("gcc.php");

$ccy = new gcc();
print 
round($ccy->get_ccy("USD""EUR"1), 2);
?>

I get the right exchange, but I need to discount 0.5 cents to the result, to match what TV and Newspapers rate, those 5 cents are banks fees...
in the operation '1' goes for the unit, and '2' for the decimals...

Any ideas? I've tried lots of variants...

kh99 11-19-2011 09:14 PM

Do you want a 0.5 cent discount (half a cent) or 5 cents?

Assuming it's 0.5 cents, I think you want this:

PHP Code:

print round(($ccy->get_ccy("USD""EUR"1) - 0.005), 2); 


LifesGreatestGift 11-19-2011 11:11 PM

Nvm

iogames 11-20-2011 07:21 PM

Thanks! [it was 0.05 btw]
PHP Code:

<?php
require_once("gcc.php");

$ccy = new gcc();
print 
round(($ccy->get_ccy("USD""EUR"1) - 0.05), 2);

print 
round(($ccy->get_ccy("USD""EUR"1) - 0.15), 2);
?>

Last question, how can add a label/tag lets say:

PHP Code:

<?php
require_once("gcc.php");

$ccy = new gcc();
print 
round(($ccy->get_ccy("USD""EUR"1) - 0.05), 2); Sale

print round(($ccy->get_ccy("USD""EUR"1) - 0.15), 2); Buy
?>

Thx!

kh99 11-20-2011 09:26 PM

You mean you just want that word to print out after the amount? You could do this:

PHP Code:

print round(($ccy->get_ccy("USD""EUR"1) - 0.05), 2) . " Sale"



All times are GMT. The time now is 12:52 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01093 seconds
  • Memory Usage 1,725KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (5)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (5)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete