justsomeguy

Moderator
  • Content count

    29,713
  • Joined

  • Last visited

  • Days Won

    331

justsomeguy last won the day on March 17

justsomeguy had the most liked content!

Community Reputation

895 Excellent

2 Followers

About justsomeguy

  • Rank
    More Human Than Human
  • Birthday 06/03/1979

Previous Fields

  • Languages
    Focusing on PHP and JavaScript

Contact Methods

  • Website URL
    http://
  • ICQ
    0

Profile Information

  • Gender
  • Location
    Phoenix

Recent Profile Visitors

262,118 profile views
  1. If you set a unique index on teamnumber, tasknumber, and date, then you can use INSERT IGNORE to insert a new record as long as it doesn't violate the unique index (i.e., as long as it's not already there). You can also use INSERT .. ON DUPLICATE KEY UPDATE to either insert a new row or update an existing row if it already exists.
  2. As long as your MySQL user has access to both databases, you can run queries on one or both of them. You don't have to "open" them, once you connect to the server you can either select a default database, or just include the database name in all of your queries.
  3. The file input ID upld, to get the list of selected files. That's what you do here: if(this.files && this.files[0]) But if that is going to run on a button click, then this will not refer to the file input, so you need to get it by the ID and then check the file list.
  4. I'm not aware of any limitations on use. They have copyright by default but I haven't seen any language about requiring attribution.
  5. This is why it runs when you select a file and the file input field changes: $(":file").change(function() { If you want a button to control that then use a click handler for the button and get the file input by ID to get the list of files.
  6. JSON doesn't "do" anything, it's just a data structure. You need to use Javascript to get the radio buttons (by ID if they have unique IDs, or another selector if they don't) and loop through them to figure out which one is checked, then you can get the value property of the one that was checked.
  7. The forum decided to eat my entire post. src = compImg; img.src = src; You're setting the src of an img element to be another img element. Shouldn't that be this: img.src = compImg.src; Is that what you're trying to do? Create a new img element and set the src of it to the src of an existing img element? For this part: container.appendChild(compImg); compImg is already on the page, is that what you want to append to the new div? Don't you want to append the element you just created? Otherwise you're not doing anything with the new element. Other than that, I would suggest using console.log statements or setting breakpoints to pause the code and look at the values of things. For example, I would check that e.target.result is something that belongs as an img src.
  8. Also, you're never going to see a request in the network console because you're not sending the file over the network, everything is being done in the browser. You're reading the local file and updating the page, not sending it to a server. That's why there's no request to a server.
  9. You'll need to check the documentation for that software to see what it supports. That almost sounds like it's running everything in some strange type of transaction where the previous statements don't have any effect until everything finishes.
  10. Since it wasn't clearly stated, you just copied and pasted the Javascript code twice. You used the same function name, and you overwrote window.onclick. The second time you define myFunction, it removes the first one (or it causes a fatal error, I'm not sure which in this case). And the second time you assign a function to window.onclick, you remove the first function that you assigned to it. You need to name things differently, names in Javascript are unique. You can't name 10 things the same thing and expect to be able to refer to all of them at the same time. And if you need multiple things to happen when an event happens, like window.onclick, then you need to combine that instead of replacing one with the other. This is one way to do that: old_onclick = window.onclick; // save the old function window.onclick = function() { old_onclick(); // run the old handler // then do new stuff } The more modern way is to use window.addEventListener to add a new event handler instead of changing things like window.onclick. https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener
  11. You should show all of your code, your attempt to make it work. Are you trying to use the name myFunction for more than function, for example? Are you overwriting window.onclick? I can't tell from what you're showing. Show your complete attempt.
  12. If you're sending string values in the URL then you'll also want to use the encodeURIComponent function to make sure the values don't break the URL. Otherwise, if you're sending a lot of data you'll probably want to just switch to a post request instead of a get request.
  13. Most of what websites? Node.js market share is at less than 1% (possibly less than 0.3%) of sites which identify the server.
  14. Sure, you can do all of the layout math yourself that the browser would normally do when it positions elements. You can decide how large you want each thing to be, how much spacing between them, how large the canvas is, etc, and figure out the coordinates to draw everything. If you want to lay out everything yourself on a canvas then you can do that, you just need to do all of the math that the browser would normally do for you. If you want a border around the image and caption, for example, then you need to decide how thick the border is and account for that space, any space between the border and the inner contents, etc. The same thing goes for text, if you want the text to wrap to the next line then it's your responsibility to figure out how many pixels long the text is and where to wrap it, there's a description about that here. When you draw on a canvas you're not using CSS to position things on the canvas and then having the browser lay it all out, you're doing all of that manually and just telling the browser the coordinates to draw everything. Anyway, that's why I was wondering why you're using a canvas instead of just creating the div and img tags and adding them to the document, where the browser will handle layout, position, wrapping, etc.
  15. You should get in the habit of structuring your code like Ingolme mentions. Put your PHP code first that will decide what the page is even going to do, and output HTML and whatever later on. If you're just going to redirect there's no reason to output a bunch of HTML anyway, right? So figure out first if you're going to redirect or show HTML or whatever else, and then do that.