Jump to content


Photo

help with this coding


  • Please log in to reply
5 replies to this topic

#1 jk14

jk14
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 30 May 2006 - 04:37 PM

hi a new to php, so here is my problem;

<?=$col?>">HKD $<?=$recSubscription['subscription_amount']?><br>[!--coloro:#FF0000--][span style=\"color:#FF0000\"][!--/coloro--]USD $<?php echo ($recSubscription['subscription_amount'] == 149) ? '20.00' : '27.00'; ?>[!--colorc--][/span][!--/colorc--]

I would like to add a third number for the USD currency but everytime i enter a number the page wont load.

How can i add '34' together with '20.00' : '27.00';

cheers guys

#2 poirot

poirot
  • Members
  • PipPipPip
  • Advanced Member
  • 646 posts
  • LocationAustin, TX

Posted 30 May 2006 - 05:24 PM

This syntax means:
If $recSubscription['subscription_amount'] is 149 it echos USD $20.00
Else, USD $27.00

This is a bit weird. Why would you want to add a third number?
~ D Kuang

#3 jk14

jk14
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 30 May 2006 - 05:44 PM

[!--quoteo(post=378440:date=May 30 2006, 12:24 PM:name=poirot)--][div class=\'quotetop\']QUOTE(poirot @ May 30 2006, 12:24 PM) View Post[/div][div class=\'quotemain\'][!--quotec--]
This syntax means:
If $recSubscription['subscription_amount'] is 149 it echos USD $20.00
Else, USD $27.00

This is a bit weird. Why would you want to add a third number?
[/quote]

there is two prices, but i would like to add a third.

how can i?

#4 GingerRobot

GingerRobot
  • Staff Alumni
  • Advanced Member
  • 4,086 posts
  • LocationUK

Posted 30 May 2006 - 08:04 PM

I dont think wha you are trying to do quite makes sense at the moment...

As it stands, if the subscription_amount is equal to 149, it displays $20 and if not, it displays $27

You would need some other condition to have three possible outputs:
if ($recSubscription['subscription_amount'] == 149){
echo "<br>USD $20.00";
}elseif(some other condition){
echo "<br>USD $27.00";
}else{
echo "<br>USD $34.00";
}

#5 legohead6

legohead6
  • Members
  • PipPipPip
  • Advanced Member
  • 434 posts

Posted 31 May 2006 - 12:39 AM

if i get what you want i would recommend using switch command

"Syntax error" .. WHERE THE **** IS IT?!

#6 jk14

jk14
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 31 May 2006 - 10:00 AM

If the ($recSubscription['subscription_amount'] has 3 options of $149, $199, & $249 in USD currency, how can i make it to show in EURO just below? so it can echo eg. EURO100, EURO 150, EURO, 175 etc..






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users