Jump to content

Leaderboard


Popular Content

Showing content with the highest reputation since 02/19/2018 in all areas

  1. 2 points
    No. UPDATE is what you use to start an UPDATE query when you are updating the table. It is not a command on its own. You might be thinking of commit, but you only need to commit if you're using transactions, which it doesn't look like you are. When you insert a record outside of a transaction there's nothing else you need to do to actually insert the record, just the insert query will do it. My condolences.
  2. 2 points
    The purpose of an object template, such as "Person" is for organizing code. In any part of your software, if you are given an object of type Person you know for sure that you can find a name and age property on it. If the object has no type then you don't know what properties it might have. You would use an object template if your software uses the same kind of object a lot. If you're only using the object in one place then you can use the shorthand {} to define it.
  3. 1 point
    Every meaningful sequence of symbols comes from a source that should have documentation that describes how to interpret the symbols in the sequence. If you have a meaningless sequence of symbols, no meaningful information can come from it.
  4. 1 point
    That's what that particular code does, yes. If that's what you're going to do though, I would do it with a for loop so it's more obvious what you're doing. var sum = []; for (var i = 0; i < ar1.length; i++) { sum[i] = ar1[i] + ar2[i]; }
  5. 1 point
    A constructor is not required for a class. The constructor is merely a place where you can put code that you want to be executed at the moment the object is instantiated.
  6. 1 point
    You need to process both, and return data from both as a single encoded JSON format .
  7. 1 point
    It doesn't work like that because you're not doing anything with the object the function returns. You could. var obj = outerFunction(); obj.kir();
  8. 1 point
    It doesn't mean anything in any languages I know.
  9. 1 point
    The computer doesn't care how many items are there, the only thing that matters is whether it follows the correct format. There are all kinds of text editors that will let you collapse whatever part of the structure you want. The built-in developer tools in the browser will do that also if you print the structure to the console. There sure is, and the browser does all of that automatically. I have never written code to parse a JSON structure, there's no reason to write that when it's a format the browser understands natively. JSON is native Javascript, it stands for Javascript Object Notation. The browser already understands it, you don't have to parse anything like that yourself. Yep. var obj = JSON.parse(json_str); console.log(obj);
  10. 1 point
    Its just a matter identifying object, transverse down to parent item, object/array using dot.notation and looping through each child item to display its value. <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <meta name="viewport" id="viewport" content="target-densitydpi=high-dpi,initial-scale=1.0"> <title>Document Title</title> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script> <script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/jquery-ui.min.js"></script> <script> visitor_data = { "lastVisits": [ { "firstVisit": { "prettyDate": "Monday, May 14, 2018", "otherItem": "recent" } }, { "firstVisit": { "prettyDate": "Monday, May 14, 2020", "otherItem": "in future" } }, { "firstVisit": { "prettyDate": "Monday, July 04, 1900", "otherItem": "WAY Way in the past" } } ] }; $(function() { for (x in visitor_data.lastVisits) { var para = document.createElement("p"); var paraText = document.createTextNode(visitor_data.lastVisits[x].firstVisit.prettyDate + " : " + visitor_data.lastVisits[x].firstVisit.otherItem); para.appendChild(paraText); document.body.appendChild(para); } }); </script> </head> <body> </body> </html>
  11. 1 point
    Indeed, kind of embarrassing to post an example where you send output before trying to set a cookie with a header. The error message with the header tells you where output was sent (in the case of the error message above, line 2), and where you tried to send a header by calling the header or setcookie functions (line 94 in that error message). You need to move anything that sends a header before any output. So, in the case of that error message, you need to set the cookie before line 2 (or just don't send any output at all until PHP is finished processing the request).
  12. 1 point
    The input tag does not save the file on the server, it just transmits the file data across the internet. The actual saving of the file is being done by server-side code that you wrote. You write the software that saves files and keeps track of them. When you delete a record from the database, the record needs to provide information about the location of the file on the server. Before deleting the record, find this information and use it to delete the file.
  13. 1 point
  14. 1 point
    A responsive line? tried a hr element https://www.w3schools.com/code/tryit.asp?filename=FQ3IJ9HRC2XE
  15. 1 point
    To make it clear on what is happening, the function within the load() is triggered after the content is loaded and load() function finished. That is why you didn't see the result you expected, the load() function was still in progress, when the scroll to top code was triggered.
  16. 1 point
    The first thing you should do is try the code yourself to see if it works. I don't see any obvious errors, so I would guess that it does work, but is unsafe on a few levels. I've removed the database information from your post to keep your accounts safe from people reading the forum. Your SQL query is open to SQL injection. Read about prepared statements to keep your database safe from hackers.nencrypted The passwords are openly visible in the database. It is unsafe for the people signing up to your site because you, and anybody with access to your database, know their passwords and you can use that to hack their accounts on other websites since many people use the same password in multiple places. To solve the password issue, you hash the passwords before storing them into your database using password_hash(). When searching for a user, you have to search by username first, pull out a hashed password and compare it to the data that was sent in the form using password_verify().
  17. 1 point
    Its not a good idea to use variable names such as form or input, as dot notation uses a similar method you are using, so confusion can arise. Even using id reference name similar to function name can cause issues.
  18. 1 point
    Looks like you're missing the opening double quote for type="text". Your browser developer tools is very useful for these situations or any situation. 😉
  19. 1 point
    If you run that query directly on your database, it returns the results you expect? I mean, you have at least one row where the sub_category field is set to "coffee / tea"?
  20. 1 point
    <input type="submit" value="Enviar"> That's all you have to do.
  21. 1 point
    You can use the condition `created_on` < DATE_SUB(NOW(), INTERVAL 3 HOUR). It uses the DATE_SUB() function.
  22. 1 point
    The code you presented is trying to create a table with two fields, each of type "VARIABLES," but "VARIABLES" is not a valid data type. My guess is that whoever wrote the query intended to write VARCHAR.
  23. 1 point
    No, utf-8 is not a valid ISO language code, it's not a language at all. It's a character encoding. But only telling the browser which character encoding to use is not enough either, you need to actually use that character encoding. If you have some web page that you saved using a Windows Latin encoding and you're telling the browser that it's UTF-8, things aren't going to be displayed correctly. I don't know if I would make the assumption that every modern browser on every platform implements all 1,112,064 valid UTF-8 code points. You only need to find one browser not implementing one character to make that entire assumption false. I try to avoid absolute statements like that, especially when they're only assumptions. According to the MDN documentation, that is not valid.
  24. 1 point
    If you want to just refresh that specific div content without refreshing/reloading the whole page, you then need to look into AJAX which will use both, JavaScript to set a time to refresh the content by going to a php page and retrieving the content produced by that page to insert into that specific div.
  25. 1 point
    At the bottom of every manual page there's a comments section. In that section you'll often find interesting additional information about the topic at hand. The same goes for the PHP manual too. From reading peoples' comments on the page you just linked to, it seems like a search term that occurs in more than 50% of the records is ignored. That may or may not be the reason you're having trouble.
×