Jump to content

gw1500se

Members
  • Posts

    1,033
  • Joined

  • Last visited

  • Days Won

    17

Everything posted by gw1500se

  1. It is not a string. file_get_html returns a DOM object. Use DOM to parse the elements.
  2. If it is auto-populated with just the year then that column should be int not timestamp. However, there is probably no reason for it to be populated by the form at all. Set the year in PHP and use that same value on the form and updating the database.
  3. There may be a problem with your schema. The column name implies "year" but the type is time stamp. What do you really want to go there? The schema also says that column cannot be null so that is why you are getting the error. The implication is '$_POST['tourn_year']' is null. You should be doing data validation first. The first question is what does that column really represent, a timestamp or just a year (type int). Where does that $_POST value come from? If it is a user entry then you need to format it into a timestamp as the user will certainly not enter a valid one. If it is automatically entered by Javascript on the form then you need to check that form to see why that value is not provided.
  4. So what did you try and what didn't work?
  5. You need to explain what those variables are and what you intend to do with them. Once you understand that, you should be able to figure out how to add them to the script and where on your own. If your attempt fails then come back and post what you tried and any error messages or what you got that is different from what you expected.
  6. Use 'name' not 'id' on your input fields.
  7. $sqlresdays="SELECT DATEDIFF(CURDATE(),MAKEDATE(YEAR(CURDATE()),1)) AS date_difference"; $resdays=mysqli_query($donnees,$sqlresdays) or trigger)_error("Query failed: ".mysqli_error($donnees); if ($resdays->num_rows>0) { $daysinyr=mysqli_fetch_object($resdays); $divider = $daysinyr->date_difference; echo $divider; $finalpop=intval($pop/$divider); } else { echo "No resullts returned from query"); }
  8. First please us the code icon (<>) in the top menu and specify PHP for your code. If what you posted is your script then nothing is echoed because you are not echoing anything. Post all the relevant code.
  9. Sorry but this is a help forum not a free programming forum. You are expected to do the work and we will help you over the humps. If you will get fired because you failed to program something you've never done before then either you are in the wrong job or working for the wrong employer. However, if you want to pay to keep your job then post this on the Job Offerings forum.
  10. I'm a belt and suspenders kind of guy.
  11. What did you try? What did not work? What error(s) did you get?
  12. Define your primate keys as 'UNIQUE' in your schema. When you try to add a duplicate key, you will get an error. Handle that error by adding the new key. As for the class question, you are being asked to create a singleton class.
  13. $_POST will normally always have values for each element in the form. However, some of the values may be "empty". So you would need to use 'empty' on each element rather than the entire array. As an aside, although it will not do what you want, based on the code comments your 'if' block should be: if (!empty($myArray)){ // Handle array }else{ // Handle empty array }
  14. Monday morning. 🙁 I told you completely wrong since $_POST will always have a value, so you need to use 'empty' instead. Also I meant for it to replace your first 'if'. if (!empty($_POST["api_key")) { That being said you still have the same problem. Since the URL is using GET you need to use the $_GET array, not $_POST.
  15. I don't see how you are getting to line 14 at all. You are checking for POST but the URL is GET. Perhaps you should be using this: if (isset($api_key)) {
  16. I would do it with JQuery get.
  17. It is unlikely that someone will go to a 3rd party to look at your code. Post the suspect code here and be sure to use the code icon (<>) in the menu. Remember to specify PHP. However, if the problem is with a 3rd party plugin I suggest you ask the author or whatever forum support that code.
  18. First please edit your post and use the code icon (<>) on the menu and select PHP. The formatter makes your code much easier to read. It is not clear what you are trying to do. Which variable(s) are you trying to set and what are you trying to set it(them) to?
  19. It is not clear to me what you are asking since "empty" returns a boolean value. Is the objective to return the first $postal* that is not empty?
  20. Did you look at the resulting HTML source to see if it looks like you expect?
  21. It may not necessarily be in error_log. There may be several different error logs depending on your configuration. Check all error logs.
  22. 500 is an internal server error. What does your httpd log say?
  23. Sorry, I didn't realize that was what you wanted to do. Someone has already done that for you on github.
  24. Check out the json_encode documentation and the JSON_PRETTY_PRINT option.
  25. Yes, the mysql extensions have been deprecated for decades. You should have switched to PDO years ago. Now you have no choice.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.