Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7504517
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T21:36:10+00:00 2026-05-29T21:36:10+00:00

I am just curios as to why Netbeans is throwing an error message at

  • 0

I am just curios as to why Netbeans is throwing an error message at the third from last line, the curly bracket? Thanks for the help.

<?php

   class convert{

var $amnt = htmlspecialchars($_GET["amnt"]);
var $cc_from = htmlspecialchars($_GET["from"]);
var $cc_to = htmlspecialchars($_GET["to"]);

function convert($amnt,$cc_from,$cc_to,$decimals=2){
$db_rate_from = mysql_query("SELECT * FROM $db_tableprefix WHERE country_code='$cc_from'");
$query_row_from = mysql_fetch_array($db_rate_from);
$rate_from = ($query_row_from[rate]);
echo $rate_from;
echo "</br>rate to</br>";

$db_rate_to = mysql_query("SELECT * FROM $db_tableprefix WHERE country_code='$cc_to'");
$query_row_to = mysql_fetch_array($db_rate_to);
$rate_to = ($query_row_to[rate]);
echo $rate_to;
echo "</br>conversion</>";

var $conversion = (number_format(($amnt/$rate_from)*$rate_to,$decimals));
echo $conversion;

}
} 
?>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T21:36:11+00:00Added an answer on May 29, 2026 at 9:36 pm

    You can’t declare variables like that in a class. You want something more like this:

    class convert
    {
    
        public $amnt;    // don't worry about what public means
        public $cc_from; // if you want to know, have a look at
        public $cc_to;   // http://php.net/public
    
        // This runs when the class is created with `new convert()`
        public function __construct ()
        {
            $this->amnt = htmlspecialchars($_GET["amnt"]); // sets that $amnt up there
            $this->cc_from = htmlspecialchars($_GET["from"]);
            $this->cc_to = htmlspecialchars($_GET["to"]);
        }
    
        // All that's changed here is making $amnt into $this->amnt, etc
        function convert($amnt,$cc_from,$cc_to,$decimals=2)
        {
            $db_rate_from = mysql_query("SELECT * FROM $db_tableprefix WHERE country_code='$this->cc_from'");
            $query_row_from = mysql_fetch_array($db_rate_from);
            $rate_from = ($query_row_from[rate]);
            echo $rate_from;
            echo "</br>rate to</br>";
    
            $db_rate_to = mysql_query("SELECT * FROM $db_tableprefix WHERE country_code='$cc_tothis->'");
            $query_row_to = mysql_fetch_array($db_rate_to);
            $rate_to = ($query_row_to[rate]);
            echo $rate_to;
            echo "</br>conversion</>";
    
            $conversion = (number_format(($this->amnt / $rate_from) * $rate_to, $decimals));
            echo $conversion;
        }
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Just curious how you would comment this line of code: string customerNm = customerNm.EndsWith(s)
Just curious if there's a way in netbeans to give type hints for regular
Just downloaded netbeans, and curious if I was to play around with JSP's etc.,
Just curious - apart from its ubiquitous use in specifying the presentation of HTML
Just curious about it... Cedric Beust created TestNG and I understand from an interview
Just curious...when writing a require/include statement, what do you prefer as better practice? require('filename.php');
I've been doing web application development for the last 3 years in PHP. I'm
Just curious, when I imported data from a spreadsheet with 519 lines into an
Just curious here: is it possible to invoke a Windows Blue Screen of Death
Just curious: 4 instanceof Number => false new Number(4) instanceof Number => true? Why

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.