whats wrong with this " if "condition?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ehpratah
    New Member
    • Mar 2012
    • 35

    whats wrong with this " if "condition?

    hi anybody can help me analyze this code..im not getting the correct output..

    Code:
    if(($origin=="NAIA 1" && $vehicle=="Small Car" && $zone=="Paranaque 2") && ($destination=="BACLARAN" || $destination=="SAN DIONISIO" || $destination=="BICUTAN INTERCHANGE" || $destination=="MULTINATIONAL VILLAGE" || $destination=="MOONWALK" || $destination=="SM SUCAT" || $destination=="DON BOSCO" || $destination=="SUN VALLEY" || $destination=="BETTER LIVING" || $destination=="MERVILLE" || $destination=="MARCELO GREEN" || $destination=="KALAYAAN" || $destination=="UNITED PARANAQUE"))
        {
        $rate=550;
        }
        if(($origin=="NAIA 1" && $vehicle=="Innova" && $zone=="Paranaque 2") && ($destination=="BACLARAN" || $destination=="SAN DIONISIO" || $destination=="BICUTAN INTERCHANGE" || $destination=="MULTINATIONAL VILLAGE" || $destination=="MOONWALK" || $destination=="SM SUCAT" || $destination=="DON BOSCO" || $destination=="SUN VALLEY" || $destination=="BETTER LIVING" || $destination=="MERVILLE" || $destination=="MARCELO GREEN" || $destination=="KALAYAAN" || $destination=="UNITED PARANAQUE"))
        {
        $rate=865;
        }
        if(($origin=="NAIA 1") && ($vehicle=="Van") && ($zone=="Paranaque 2") && ($destination=="BACLARAN" || $destination=="SAN DIONISIO" || $destination=="BICUTAN INTERCHANGE" || $destination=="MULTINATIONAL VILLAGE" || $destination=="MOONWALK" || $destination=="SM SUCAT" || $destination=="DON BOSCO" || $destination=="SUN VALLEY" || $destination=="BETTER LIVING" || $destination=="MERVILLE" || $destination=="MARCELO GREEN" || $destination=="KALAYAAN" || $destination=="UNITED PARANAQUE"))
        {
        $rate=1300;
        }
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    How can we help if we don't know what the correct output is? We would also need to know the input and the resulting wrong output.

    Comment

    • ehpratah
      New Member
      • Mar 2012
      • 35

      #3
      well basically it will print for the price rate of the car depending on the origin,destinat ion,vehicle type,

      Code:
      $origin = 'NAIA 1';
      $vehicle = 'Van'; # switching with 'Innova' and 'Vios'
      $zone = 'Paranaque 2';
      $destination ='BACLARAN'or 'Luneta';
      $rate = 500;
      the output will be

      rate=500

      Comment

      • Rabbit
        Recognized Expert MVP
        • Jan 2007
        • 12517

        #4
        Well it's impossible for rate to output 500 since you set it to 550 in your code.

        Comment

        • ehpratah
          New Member
          • Mar 2012
          • 35

          #5
          LOL..funny thing is i try to read the line almost a hundred times figuring were did i go wrong..just to find out that i place the wrong price..it almost took me 1 whole day just to find it out..bad bad bad..any way thanks

          Comment

          • Rabbit
            Recognized Expert MVP
            • Jan 2007
            • 12517

            #6
            Happens to everyone, good luck.

            Comment

            Working...