Jump to content

Ingolme

Moderator
  • Posts

    14,901
  • Joined

  • Last visited

  • Days Won

    177

Everything posted by Ingolme

  1. Give it a class name and use the class selector. This is in the first page of the CSS tutorial: https://www.w3schools.com/css/css_syntax.asp
  2. That's not how getElementsByClassName works. Putting both class names there will only give you elements that have both of the values in their class attribute. If you want to search for elements that contain either one of the classes. then you have to call getElementsByClassName twice.
  3. It probably was saved with orientation EXIF data. Find an image editor that can change the EXIF data and use it to fix the image.
  4. To answer your first question, there is no need to instantiate PHPMailer inside your class. PHPGlobalMailer is a PHPMailer, that is the meaning of inheritance. To answer your second question, the character set only applies to the instance $user_mail and not to any other mailer instance. That line will also override the value provided in the constructor. Your PHPGlobalMailer class, as shown above, does not do anything different from PHPMailer, you need to make a few fixes. The line $this->mail->CharSet=self::$char_set; must be inside the constructor. You cannot have loose lines of code inside a class. The above line of code should probably be changed to $this->CharSet=self::$char_set; since you don't need the $mail property. If the $char_set property is not being used anywhere else except the constructor then you should just delete it altogether and putting the literal string in the constructor so that it looks like this: $this->CharSet = 'UTF-8'; You're not doing anything with the ($email, $username) arguments of the constructor. You should write some code that uses them. The constructor should call the constructor of the parent class as in the following example: public function __construct() { parent::__construct(); // // ... The rest of your code here ... // }
  5. Both of them are equally efficient, they reserve the same amount of memory and they take the same amount of processing time. The only difference between them is the context in which the memory is reserved. I would recommend with putting the entry variable inside the each() callback only because you don't need it anymore after the process has ended.
  6. It can't be done with CSS, but it can be done with Javascript by setting the element's scrollLeft property to scrollWidth - clientWidth. jQuery is not needed.
  7. The last example I wrote is a bit more complicated at the processor level, I was just showing an alternative way to do things. It is probably best to have the declaration inside the each() callback as I said initially. You're mostly correct, with a couple of differences due to the way scope and references work. 2) If the space does not have an object yet, it behaves as you said and puts the object in that space. If there was already an object in that space, the variable entry is changed to point to a new space in memory and the new object is placed there instead. The old object remains exactly where it was as long as there is a pointer to it from somewhere, like the entryArr array. 3) The value is not retrieved from the storage space, instead the array just contains a reference to that space in memory telling it that the object is there. This distinction is important, because the error you had initially occurs because all of the array elements had pointers to the same piece of memory meaning that changing one of them would change all of them. I've attached a short diagram explaining basically how the memory works in this situation. It's not 100% accurate, but it would take at least a semester course to teach the details.
  8. No, it is the same function. Every time the program enters a function, new memory is allocated for it. When the program leaves the function all of the memory used by the function is freed unless there are pointers to it from another part of the program, such as the array that was declared outside.
  9. Ingolme

    Table has error

    The leading slash is looking for the file at the root of the server. You almost never need to start a path name with a slash. You have to replace that with the actual path to the file. If the file is in the same directory as the current PHP file, then removing the slash will fix the problem. If it is in a sub-directory then you need to put the name of the sub-directory in the path. Where is connect_db.php in relation to the current PHP file you are writing?
  10. The problem before is that you created only one object and on each iteration you changed the properties of that object and added a new pointer to it from the array. What you really need to do is to create a new object on each iteration. You can recreate the variable every time because it is inside its own function. Another option would be to declare the object outside and initialize it inside the loop: var entry; // Reserve memory for storing objects $.each(inputArr, function(key, object) { entry = {}; // Create a new instance of an object and place it in the reserved memory for(var property in propertyArr) { var prop = propertyArr[property]; entry[prop] = object.prop; // Set the properties of the object } entryArr.push(entry); // Add a pointer to the new object at the end of the array }); return entryArr; They both do the same thing but for different reasons.
  11. Ingolme

    Table has error

    This line is probably causing the program to halt because it cannot find the file: require('\connect_db.php'); Starting with a backslash on Linux will not work correctly, and on Windows it will look for the file at the root of your computer, which is probably directly under C:\ depending on how Windows was set up.
  12. Ingolme

    Table has error

    The code from your first post is PHP code, not SQL, but you seem to be running it in an SQL environment. It should be in a PHP file. The code also is missing a "." at the end of the first line to concatenate it with the next line. I'm under the impression that the duplicate first_name is a result of not copying what was in the book correctly.
  13. You can send an XMLHttpRequest periodically and check that the HTTP status is 0. Building up on the line of code you provided earlier. // ... More code xhttp.open("GET", "online_check.txt", true); xhhtp.onreadystatechange = function() { if(xhttp.readyState == 4) { if(xhttp.status == 0) { // Show disconnected message } else { // Show connected message } } } // ... More code To save on server resources, you probably should not make requests more frequently than once every 5 seconds.
  14. You declare a variable only once, then use it as many times as you need to. Using the var keyword creates a new variable. It doesn't make sense to create a variable that already exists.
  15. Which browser has the issue? I know that Internet Explorer / Edge will refuse to show certain fonts if you haven't obtained a licensed version of it. You can tell if that's the case because The browser's console will show an error message about the font. If this is your problem, the solution to the problem is to modify the font file, here's a tool that can help fix font files: https://www.fontsquirrel.com/tools/webfont-generator
  16. You're calling the subroutine passing in variables that have not been initialized. Initialize the variables first, then call the subroutine.
  17. In what way? In HTTP, the connection between client and server ends as soon as the page finishes loading.
  18. The Javascript console says that "w3_close" does not exist. I checked your function definitions and they are inside the following script tag: <script type="Javascript"> That syntax will probably not work, the browser thinks it's not Javascript so it won't run it. Either omit the type attribute or set it to one of the valid values: "application/javascript" or "application/ecmascript"
  19. Is it not possible to just include the Javascript file with a <script> tag?
  20. That's a feature that only kicks in when the font in your dropdowns is smaller than the standard for accessibility, it was designed to help people with poor vision. You can prevent that by making sure that your dropdowns have a font size of 16 pixels or greater. I advise against changing the value of any meta tag, these are read once when the page loads and are never expected to change. I can't answer your question about the iPhone keyboard since I don't have the means to reproduce it right now and I don't fully understand the issue. I would expect the keyboard to span the full width of the phone's screen, there's not much space on it and there are a lot of letters to cram into there. Given that you mention that the issue is similar to the dropdown one and that it occurs when focusing the search field, I would suggest making your search field larger as well.
  21. That's because you're using mysqli_real_escape_string. You don't need that function, that's only for databases and it's also only used in really old code. If all you're doing is sending an e-mail, remove the entire database connection file. For escaping things in an HTML e-mail, use htmlspecialchars(). That semi-colon is correct, it separates two of the components of the Content-Type header.
  22. Add "clear: both" to the CSS of your footer. Content that follows a floated element will try to go next to it.
  23. There is no command to end the program, but if there are no event listeners, you can wrapall of your code in a function and call "return" when you want it to end. If you do have event listeners then you will have to remove all of the event listeners before stopping the program.
  24. If you want to detect that a string has a line break, you just search for "\n". In the following code, the variable "hasLineBreak" will be true when the string has a line break in it. var hasLineBreak = str.indexOf("\n") >= 0; You might want to split a string by its line breaks. The following code creates an array of strings, each string is one of the lines of the first string. var lines = str.split("\n"); When printing a string to HTML, if you want the line breaks to still be visible, you have to replace them with <br> tags. Here's how you would do that: var output = str.replace(/\n/g, "<br>"); element.innerHTML = output;
×
×
  • Create New...