Jump to content

Ingolme

Moderator
  • Posts

    14,901
  • Joined

  • Last visited

  • Days Won

    177

Everything posted by Ingolme

  1. So how would you find out when that happened? Before writing code, have you written down in words exactly what your program does? Try to describe it to somebody who doesn't know code.
  2. When do you want it to run? You have to call the function somewhere.
  3. You have an almostDead() method, but at no point is your program using it. It's just there, not being used. You should use a code box to put code on the forum, and try to properly indent your code and keep closing braces on their own line for readability.
  4. Background images repeat by default, you have to explicitly specify it if you don't want the image to repeat. I saw your PDF, but I don't know what kind of box model you're referring to.
  5. I know this is supposed to be a joke, but it's not really funny.
  6. THe space below the block can be removed by setting the vertical-align property to "middle". The space between divs can be removed by having all the HTML one following another, no line breaks or spaces between the tags. If you're seeing space between the divs, that means that the code you're using is not the code you posted here.
  7. Ingolme

    PHP problems

    There is only one class definition with only one constructor, you can make as many instances of the class as you want without making any change to the class. You probably should make a different thread for this since it's completely unrelated to the topic.
  8. What's bad practice is to use divs where more appropriate elements could be used. But there's no problem with using divs when you need to group things together and can't find a better element to do it,
  9. I would start by setting the vertical-align of the <img> elements on the right column to "middle" to align it with the text. I would not give your sidebar padding if you intended to have some elements stuck to the edge. You should wrap the elements you want offset by 3 pixels in a container with padding, leaving the others without padding. You should be wrapping every heading followed by links in its own container since it makes sense to have those links grouped together.
  10. What differences have you found? They actually do different things, though the appearance of both of those examples should be very similar. Most likely the first example will appear to have a slight offset on the left and a slight separation from anything below it.
  11. I actually don't think it's important. It has the potential to mess up the DOM. I have never had a need for it.
  12. PHP is not aware of the existence of HTML. HTML is not aware of the existence of PHP. You can put PHP absolutely anywhere in the HTML, it doesn't really matter. You can even do this: <h<?php echo 2;?>>Text</<?php echo 'h'; ?>2> All PHP does is output text, which may or may not be valid HTML.
  13. The semi-colon in CSS is used to separate CSS rules. If there only is one rule then the semi-colon is not required. Since "R" is pronounced "are" it's actually correct to use "an". Your last suggestion is correct. That's incorrect grammar. The W3School staff practically never come to the forum, but if you go to any page on W3Schools there's a "Report Error" link at the bottom of the page. Clicking on it will open a form that lets you send a message to them indicating that something on the site is incorrect.
  14. I've never heard of them. Perhaps you should research the company. Start from their website, if they have one.
  15. I think if the concept is difficult to understand you still have to learn more basic things. Learn how to connect to a database and store and retrieve information from it.
  16. I'm not sure if they allow you to upload plain PHP files there. You should set up a virtual server on your computer to test PHP and MySQL. Search for XAMPP and download it. Once you're familiar with PHP and want to publish a website, find a real web host and upload the PHP files there.
  17. You can store the date produced by strtotime() in a database. When the page loads, check the database row associated with that user, if the trial end date is not there, create it using strtotime(). If it is there, then calculate the difference between then and now. Another way to do it would be to store the time the trial started, then each time you load it from the database you compare the current time with it to see if more than 10 days have passed. This way is more flexible because you can change the target time after the countdown has started.
  18. Ingolme

    PHP problems

    That's why you need substr(). You have a number you can use in it.
  19. Ingolme

    Inner Joins

    When you join two tables, the ON clause must associate a field of one table to a field of the other table. Currently you're associating two fields from the same table. You also are only selecting fields from one of the tables and not the other. Here's an example of how to properly do a join SELECT table1.field, table2.otherfield FROM table1 INNER JOIN table2 ON table1.id = table2.id WHERE table1.field < 10
  20. Ingolme

    sitemap

    One link for every page on your site, except those that are dynamically generated.
  21. The most specific selector is the ony that gets chosen. That selector is so specific that the only way to override it would be to add an ID attribute to the element. You probably should change the selector to not be so specific. The direct child selector is more specific than the descendant selector, the more parts a selector has the more specific it is.
  22. Ingolme

    images

    That's pretty much a contradiction. If the TV shows and movies themselves are not public domain then neither are screen captures of them. Only the creator of the media can give you permission to use them.
  23. 1) The "a" flag means that when calling fwrite() on the file handler the content will be added at the end of the file. 2) file_get_contents() returns a string containing all the data from the file. I don't know how else to explain it. 3) It's a web standard. Read more about it here: https://en.wikipedia.org/wiki/Percent-encoding I don't know why they chose to only use 20 characters. The rest of the characters are not used, those 20 characters are the only ones used. 4) By load I mean it reads the file and takes those characters and puts it into a variable. I don't know why they decided to limit the line length to 1024 character, you should as the person who gave you the code. In the file they're reading, each line has the data for one use, that's why they read it line by line. strlen($line[$i]) gives the length of the show line. 1 is subtracted from that because the pointer can only go as far as one character before the length. $len is the size of the data they wanted to extract. If the full line was 100 characters and the string they're reading from was 20 characters long, the resulting value of that expression would be 100 - 1 - 20 which is 79 and the substr() function would be equivalent to substr($line[$i], 92, 79) which actually doesn't make sense, their code seems to be wrong and probably only works because the length they're providing exceeds the length of the string they're reading from.
  24. If you did not arrive to the page by submitting the form, then $_POST['data'] will be undefined and PHP will show an error message.
×
×
  • Create New...