Jump to content

requinix

Administrators
  • Posts

    15,266
  • Joined

  • Last visited

  • Days Won

    431

Everything posted by requinix

  1. Before dealing with this, you need to change to using prepared statements. Because as your code is now, someone could submit malicious data into your form and completely screw up everything in your database. Not sure whether you're using PDO or mysqli, but both of them support it. Switch now. It might even fix your problem, too.
  2. You can't create the "map"? And the map is... what? An HTML table? An array that looks like the "matrix array" but has numbers instead of true/false? What have you done so far? What is the output you want to receive?
  3. HTTP/1.0? Really? That's... very surprising. Are you sure you're seeing what's really happening? The browser isn't translating anything to be "nice"? What do your server access logs show?
  4. Write your own code to format the string according to the diff and invert. Not if it there was a fractional part of a day involved. It's not 2 days, it's 2-point-something days. PHP does not have a "just the date" type. There's always a time value... It's still not quite right. Check the docs for DateInterval and format to make sure you're using them correctly.
  5. I didn't mean for you to throw away the code you had before... I meant, you had a specific thing that tried to read each CSV line from the line, using str_getcsv, and instead you replace that with a call to fgetcsv (plus add in fopen/fclose because you have to). Definitely keep the array_combine and whatever.
  6. Oh. Well that's easy: You simply have the diff backwards. $object->diff($date) is the diff from $object to $date, and works like $date minus $object. $today->diff($tomorrow) is positive, $today->diff($yesterday) is negative.
  7. That's how many people feel about it too. Personally, I use whatever is most accessible. If this is an element then I'd rather write this.value over $(this).val(). But for stuff like selectors or events? Even with document.querySelectorAll and global support for addEventListener, jQuery is still easier.
  8. Looks right to me. What do you think those should be?
  9. Oh dear. If you control the server then you don't need to do this. If you don't control the server then the client can just go in and remove this shackle. If the client has not paid up, don't give them control of the site. It's that simple. Wait until the contract is complete and you've received payment before handing everything over to them.
  10. No surprise: you're reading the file line by line and feeding each line to str_getcsv. Switch to using fopen, fgetcsv, and fclose.
  11. Yeah, it was fun times back then. They tried to get us all on one of their other forums, but... ugh. I had been on here before they shut DevShed down and I recommended it to anyone else (who cared about PHP). There are a couple other DS alumni somewhere around here, too. It's definitely good to have people maintaining the forum you use. People who actually, you know, care about it. Who aren't just letting it sit there accumulate ad revenue while running years-old software.
  12. If array_combine is finding that the two arrays ($header and $values) have different lengths then you should troubleshoot for when those two arrays have different lengths. As in if (count($header) != count($values)) { print_r(["headers" => $header, "values" => $values]); }
  13. It no longer exists? I assume it existed when Apache was last restarted?
  14. MySQL is a database, not a programming language. Suck it up.
  15. ...yes? Like I said, the problem was that the regex needs to be a string.
  16. The closest I can come up with after a few minutes of thought is (also) to use regex_replace, but to remove not just lowercase letters but anything that isn't an uppercase letter. That will include punctuation too. It won't handle all city names very well, though. What you really need is a column for the shortened form of the location. The problem with your attempt at it is that the regular expression is a string.
  17. I don't know what you're trying to say so... probably not. Every time a function runs, it has a this. It is not inherited like you think - it's not a variable like that. Instead, what it is depends on how the function is called. It's kinda weird like that. The main function here is the callback for the click event. jQuery is the one calling your function and according to the docs: So it will be the .compare-change button. But only for code written directly inside this callback function. Later when you do the .each, inside that function the this is not inherited. As before, it depends on how the function was called. And as before, jQuery is the one calling your function, so you should consult the docs: Thus inside that function the this will be each element being iterated over.
  18. There's the problem. Your distro manages PHP extensions with the INI files, where opcache is enabled, but there's also a modification to your php.ini to load it again. Open up php.ini and remove the zend_extension line. Then look nearby for other edits that also don't belong in that file.
  19. You mean can you write $(this) like you're already doing in other parts of the code?
  20. By the way, some quick feedback: - Don't use the text of the button to decide what it should do. Use a class. Or a data attribute. - attr(class) gives you the value of that attribute. It does not test for the presence of a class. What if you added another one? Use .hasClass(compare-results) or .is(.compare-results). - $(callerCellRow children, this) is weird. I'm not even sure what jQuery whether would ignore the second argument or transform the first into a selector, but the docs probably answer that.
  21. exit isn't a thing in Javascript. You're killing the event callback by trying to call a function that doesn't exist. It's an error. Use return.
  22. The "normal" and "/ version" are the same thing. Duplicate title tags sounds like it means duplicate <title> tags. Check your HTML markup.
  23. Actually, before that, You're having the problem through Apache but you were looking at the CLI configuration files. You need to look in /etc/php/7.2/apache2 (I think) for the appropriate configuration files. But if you still don't see it there, first grep through /etc/php/7.2/apache2. There should not be many results at all. Look for references to the INI file or the extension's .so. The next place would be /etc/apache2 in case someone put PHP configuration settings in there. After that comes your website's configuration.
  24. By homepage, are you talking about the root of the domain? example.com, and not like example.com/homepage? Technically there is always a trailing slash for domain roots. Because it's not a trailing slash per se but rather a leading slash. And you cannot get rid of a leading slash - example.com and example.com/ are the exact same thing. What exactly is the software saying?
  25. You could try, but that would require extra data to be submitted in the form and that means more room for error. So instead of that, do what I said before: figure out the current list, figure out the new list, and compare the two. You mean if there's a better way than outputting Javascript? Yes.
×
×
  • 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.