Jump to content


  • Content Count

  • Joined

  • Last visited

  • Days Won


Everything posted by justsomeguy

  1. Yes, only public members can be access from outside the class. It's common to make things private and then have public getter and setter methods: class AccountInformation { private $fname; public function __construct($fname = '') { $this->fname = $fname; } public function getFname() { return $this->fname; } public function setFname($fname) { $this->fname = $fname; } } $acct = new AccountInformation(); $acct->setFname('Steve'); echo $acct->getFname(); The difference between protected and private is only with extended classes. Neither of th
  2. Inside the event handler, it refers to the element that fired the event. So whatever element was clicked on.
  3. The constructor always needs to be public. If you want properties to be private you need to declare them as private first. It's common to declare all of the properties before the methods. class AccountInformation { private $fname; private $connected = false; // you can initialize variables but only to scalar values, you can't initialize a property to another variable public function __construct($fname = '') { $this->fname = $fname; // you can only access a private property from inside this class $this->connect(); // you can only call a private method from inside
  4. Hello. There aren't a lot of Java developers here, but what questions do you have?
  5. That means that it can't find the pear packages for whatever reason. You don't really need to install PHPMailer, just upload the files with your code and include them. There's a button to download the zip package on the GitHub page, you need to upload the files inside the src directory, include the main PHPMailer class file in your code, and you can use it. They have instructions for installing with composer and whatever else but that's just overcomplicated.
  6. It seems like a sort function would just change the order that the results appear. If you want to limit what is returned you probably have to change the table specification to tell it to only return specific columns, but I'm not familiar with what you're using. Hopefully it has documentation that you can use to check what your options are.
  7. No, it's not native. It's on GitHub though: https://github.com/PHPMailer/PHPMailer There's a button on the top right to download the zip package, all of the files you actually need are in the src folder.
  8. If that is the full contents of the function, then yeah it doesn't actually do anything.
  9. Why do you want to use mail? How about something like PHPMailer instead?
  10. It looks like there's a guide here, you might also need to change the ServerName setting or other files: https://stackoverflow.com/questions/11294812/how-to-change-xampp-apache-server-port
  11. Why would the div have a height greater than 0? Where are you telling it to be larger? There's not much to explain about the console.log line, what question do you have about it?
  12. What errors are you getting? If Color is supposed to be a value and not a variable, you need to quote it.
  13. It will listen on whatever port you tell it to, but you'll need to change the URLs in the browser also. Skype is the most common application that listens on port 80 and blocks other applications from using it.
  14. Install a web server on your local PC. If you're using Apache and having problems, check the log files.
  15. https://www.php.net/manual/en/function.debug-backtrace.php
  16. I'm not sure, I'm not watching you. What does "no localhost" mean, that means you can't connect if you open http://localhost/? The browser says it can't find the server?
  17. You can download a package like XAMPP that has everything you might need. You really only need Apache or another web server though if you're only serving static files. Some versions of Windows have the IIS server included but you probably need to install it through the control panel first.
  18. document.getElementById('addItem') doesn't refer to an element. It looks like you also have an extra quote at the end of that onclick attribute.
  19. You can use the + operator to concatenate. https://www.w3schools.com/js/js_operators.asp
  20. You're mixing mysql and mysqli functions. They don't work together. You also immediately overwrite your insert query with a select query because you're using the same variable name.
  21. Keep a counter, i in the code above, as a global variable. Every time they press the button, display feedback_array[i] then increment i to point to the next item for when they press the button again.
  22. You use a select query to get matching records and see if you get any.
  23. It's just the initial value. If you don't start off with an initial value then you make a new object every time and return it.
  24. That's just a alternative way of defining a function in EcmaScript 6. It's saying the function accepts 2 parameters, countDates and date, and then has the statements where it builds and then returns the array. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions The empty object is the initial value to use for the accumulator for reduce. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduce
  25. It will return an array of the frequency of dates. The line that sets countDates[date] is equivalent to this: if (countDate[dates]) { countDate[dates] = countDate[dates] + 1; } else { countDate[dates] = 1; }
  • Create New...