Jump to content

Ingolme

Moderator
  • Posts

    14,901
  • Joined

  • Last visited

  • Days Won

    177

Everything posted by Ingolme

  1. This looks copied and pasted from some kind of homework question. Can you tell me how far you've gotten on your own and which line of code you don't understand? The language attribute on the script tag is deprecated and shouldn't be used.
  2. Starting date_modified at zero can indicate that the item has never been modified before. date_created has to be set as soon as the row is created.
  3. The best way to find out if the code works is to just test it. That's only half of the code you need. Without the second half, that code will just take you to the top of the page. The second half of the code is <div id="bottom"></div>. That piece of code has to go to the part of the page that you want the user to jump to. In your case, the bottom, which means that it has to be the very last thing in your code. CSS classes are explained on this page of the CSS tutorial: http://www.w3schools.com/css/css_syntax.asp You should read that entire page (and probably the rest of the tutorial), but the important part is down at the "The class Selector" section. The class selector (a selector preceded by a dot) selects all elements that have the specified word in their "class" attribute. (read about attributes here: http://www.w3schools.com/html/html_attributes.asp) Here's a CSS rule using a class selector: .abcdefg { color: red; } These rule will make the text red for all these elements: <div class="abcdefg">Red text</div> <span class="abcdefg">Red text</span> <p class="abcdefg something">A paragraph with red text</p> Notice that in the last element I have two class names in the same attribute.
  4. Are you getting any error messages? It's advised to not use the mysql library, it is deprecated due to security vulnerabilities. The PHP manual has a warning: http://php.net/mysql_query
  5. Users cannot change their own usernames, this is the default setting on most online platforms. If you need your username changed you can send a private message to a moderator. Which exercises are you referring to? If you were using the Try-it editor (like this one http://www.w3schools.com/html/tryit.asp?filename=tryhtml_default), those don't save your work, they're just there for you to test what you've learned.
  6. It works, but only if the user doesn't put special characters in the text. If the user's name is O'Reilly your code will break. The code you posted has this: $sql = "INSERT INTO stagiaires (nometudiant, noetudiant, mdpetudiant)VALUES('$nom', '$num', '$motpasse')"; $sql = "INSERT INTO associations (noetudiant, noemployeur, noemploye)VALUES('$num', '$emp', '$super')"; but that's just creates a string, where's the code that executes the SQL string?
  7. If you understood, then you would be doing it correctly. Please stop to read carefully, I've explained it very clearly. The link (or button) needs an href attribute. That attribute has a URL pointing to the page and position to which you want to go. The hash is the important part of the URL. You can call it "bottom", or "end" or "anything", it doesn't matter what you call it, it's just an identifier for a part of the page. Here's your button: <a class="button hexagon" href="#abcdefg">Chcete se dozvědět více?</a> This piece of code has to be at the very end of your code, as far down on the page as you can put it. This is where the browser will go when you click on the button <span id="abcdefg"></span> You'll notice I used a <span> instead of a <div>. That's because it doesn't matter, you can use anything you want as long as the ID attribute has the right value. Here's a page in the W3Schools tutorial which explains exactly how to do it if you read carefully. Read the "HTML Links - Create a Bookmark" section: http://www.w3schools.com/html/html_links.asp
  8. I think you need to understand how browsers render width and height. They're different. By default, block elements expand to take up as much width as possible. They will be as wide as their parent elements allow them to be without exceeding boundaries. By default, block elements shrink until they take as little height as possible. They are only as tall as the content inside them. min-height prevents the box from getting any smaller than the specified value. That means that if there isn't enough content in the box to make it any taller it will stay at the min-height. If you're setting min-height or max-height then there's no reason to set the height.
  9. URLs have the following components: http://www.example.com/path/file.html?a=value#target http:// Protocol: Tells the browser how to communicate with the server. www.example.com Host name: Tells the browser where on the internet to go. /path/file.html Path: Tells the server what file was requested. ?a=value Query string: Tells the server what information is requested. #target Hash: Tells the browser where on the page to go The component we're dealing with here is the hash. When you click on a link with a hash in it (<a href="page.html#something">) it scrolls you down to the element that has an id attribute with the specified value. If the hash is "#target" then it will scroll to <anything id="target"> If the hash is "#bottom" then it will scroll to <anything id="bottom"> In these examples "<anything" refers to the name of the element, it could be <div>, <h1>, <p>, <span> or any other element. The only important part is the id attribute.
  10. Your page has to have a <body> tag. HTML should have an <html> tag, a <head> tag and a <body> tag with the following structure: [ As shown in the tutorial http://www.w3schools.com/html/html_head.asp ] <!DOCTYPE html> <html> <head> <title>Page Title</title> </head> <body> The content of the document...... </body> </html> Please read the HTML tutorial again, your code needs to be valid in order to work properly. You can check if your code is valid here: http://validator.w3.org/#validate_by_input
  11. I just checked and they are getting sent. In most browsers you can open developer tools using F12. In the "net" or "network" tab it shows what is being sent to the servers. If there's a "persist" button you should click on it, since it clears the console when a new page is loaded and the server-side code is redirecting after the POST request is received.
  12. Rather than using the click event of the button, I would use the submit event of the form. $('#feature_form').on('submit', fcat.overrideSubmit); But why is Javascript necessary? PHP should be able to pick up the form inputs without the need for Javascript. The network tools tell me that activeOnCats is being sent to the server side, so debugging needs to be done on the PHP side. I'd start by printing out the values that are being received: echo Tools::getValue('activeOnCats'); exit;
  13. The first issue I'm finding is a browser security issue. It's refusing to load jQuery because you're using http instead of https, but it looks like there's another jQuery library already loaded on the page, so it's most likely a good thing that jQuery 1.7 isn't loading. The save button redirects to another page, so it doesn't look like there's any time for the Javascript to run. Can you show your Javascript code?
  14. I see you creating an SQL string, but no database connection is open. You should never put variables in the SQL. You should use prepared statements. There's a page in the tutorial about prepared statements. http://www.w3schools.com/php/php_mysql_prepared_statements.asp
  15. The tutorials teach the basics which are not scheduled to change. They teach Javascript which is compatible with all modern browsers.
  16. A kilobyte is 2^10 bytes. 2^10 * 153 = 156672. If you account for the fact that the number is rounded down the file should be the exact same size. We can do it the other way around, divide bytes by 2^10 and truncate the result: 157317 / 2^10 = 153.629882813 Truncating (removing the decimal part) results in 153. A megabyte is 2^20 bytes and gigabyte is 2^30 bytes.
  17. I see no reason to store that after you have moved the file.
  18. You can't use the name attribute. It is deprecated. Put this right before the closing </body> tag <div id="bottom"></div> Then link to it from anywhere using #bottom as the URL <a href="#bottom">Bottom of document</a>
  19. "Premium" is a very vague word. How do you define premium? Generally you need to be able to decide what a page should look like before you start writing code. That's what image editors are for. You could draw out your design on paper as well. After that, all you need is good HTML and CSS skills.
  20. This is what happens when people don't read the documentation of a function before using it. Read this page: http://php.net/print_r print_r() prints the content of a variable and returns true. So when you echo the return value of print_r() it displays "1" which it the string representation of true. You can remove the echo statement and the code will still work except it won't add "1" to the output.
  21. I believe mysqli does not throw errors either, you have to test that the query returns false. You can also set error reporting with $mysqli_driver->report_mode
  22. What type of object is $db? PDO won't throw errors unless you specifically tell it to. $db->query() will just return false if the query is wrong. If you're using PDO, be sure to set the error mode http://php.net/manual/en/pdo.setattribute.php $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
  23. Ingolme

    SQL count help

    I don't think a single query can do that. With two queries you could do the following: Count active: SELECT Company, COUNT(*) FROM production WHERE Status = 'Active' GROUP BY Company Count complete SELECT Company, COUNT(*) FROM production WHERE Status = 'Complete' GROUP BY Company
  24. json_decode() returns null if the input string is not valid JSON. You should print out the string and see what's wrong with it. urlldecode() should not be necessary because the content is already decoded before being put into the $_POST array.
  25. This is not about JSON, this is about Facebook's API. I don't know anything about their API, but I would start by reading the documentation they provide.
×
×
  • Create New...