Jump to content

maxxd

Gurus
  • Posts

    1,718
  • Joined

  • Last visited

  • Days Won

    55

Everything posted by maxxd

  1. Works for me - what exactly are you seeing? <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Testing before</title> <style> .color-top-border-pink-green:before { background: linear-gradient(to right,#e0218a 17.85%,#bff010 53.28%,#96BD0C 100%); content: ""; height: 4px; width: 100%; display: block; } .color-top-border-pink-green{ height: 350px; width: 99vw; background: url('https://images.unsplash.com/photo-1507525428034-b723cf961d3e?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=2073&q=80') center center no-repeat; } </style> </head> <body> <div class="color-top-border-pink-green"></div> </body> </html> Note that there is a small chance I'm breaking copyright rules with that background image - I honestly don't know. It comes from here: https://unsplash.com/photos/KMn4VEeEPR8
  2. It really doesn't matter - I personally like OOP, even in plain PHP projects. However, when I start something new I reach for Laravel because my jobs have used Laravel for the past 4 or so years and by now I'm somewhat familiar with it. I also liked CodeIgniter 4, though there's not as much built-in functionality there as Laravel (but that can be nice as there's also not as much magic to deal with). Biggest problem I find I have nowadays jumping into a procedural or functions-based system is keeping track of what function comes from where. When everything is in the global namespace I find that things can get messy and confusing.
  3. What's the issue you're trying to solve? I'm extrapolating (perhaps quite heavily, tbh) but given your variable names I wonder if what you're trying to achieve would be better suited to CSS than JS.
  4. That's a completely different form in the JS Fiddle than what you've described already. Post the code and we can help. Some more things right off the top, don't set the form 'action' attribute based on what button's clicked - use the JS to set a hidden field in the form and leave the action attribute empty. That way the form will submit to the current URL. Set up your page in this order from top to bottom: PHP HTML JavaScript This allows you to handle the form submission first and display any errors to the user. It also allows you to not have to maintain three separate files for very similar functionality. Also - as I said before - prepare the query before the loop, then set $paramValue and execute the query in the loop. This way you're not wasting cycles preparing the same statement on every iteration - it only needs to be done once.
  5. You don't have a form input named 'users' and you never actually execute the query. That's a couple of several issues I see with this code - first, I assume your php is being called via ajax from the JS setUpdateAction() function? If so, you'll want to echo output and let your javascript handle the return instead of issuing a location header. Also, one of the joys about prepared statements is that you can prepare them once and use them multiple times - if you're doing the update in a loop prepare the statement before the loop, then bind and execute it in the loop. Also, if you're using mysqli I recommend switching to PDO now - it's just a better interface. Beyond that, you don't need two consecutive require_once statements for the same file; the name pretty much says it all (require once), and there's no need to jump through the hoops you're doing to assign evenRow or oddRow class names - just use CSS's nth-child() selectors.
  6. No matter what, by passing no third parameter to the filter_input function no filtering will actually happen and all of this is pointless. From the docs: filter_input( int $type, string $var_name, int $filter = FILTER_DEFAULT, array|int $options = 0 ): mixed and It's not clear what's happening with the submitted data (except for the one random output of $preApprovalAmount), but the OP needs to actually handle the input in a manner appropriate for the usage. If it's for a DB query, use prepared statements. If it's for output, use htmlspecialchars() or htmlentities().
  7. I could be remembering incorrectly, but I feel like this used to be available before google announced the move to GA4 and away from its Universal Analytics. In my experience, the move to GA4 made everything more complex, time consuming, and difficult. In my last job even extremely experienced data scientists were having trouble figuring out how to map and track user interactions, and this was after extensive meetings with the dev team about implementation. This is probably a jaded and unfair opinion, but I feel like as long as a company/user has enough money, google will find a away to show them the data they're looking for. Grumpy rant over...
  8. You'll need to use https://developer.mozilla.org/en-US/docs/Web/API/Clipboard/writeText to actually copy the text into the clipboard. You'd do this in the copyToClipboard() function kicken's post recommended you create.
  9. Continuing a long history of over-engineering because it reads easier to my particular brain: echo (new DateTime('first day of last month', new DateTimeZone('America/New_York')))->format('M j, Y'); Returns 'May 1, 2023' which, as of today, is correct. Thanks @Barand and @requinix.
  10. Well damn - I had in my head that it accounted for that. I was wrong.
  11. Or, if you just really like to over-engineer things: echo (new DateTime('now', new DateTimezone('America/New_York')))->sub(new DateInterval('P1M'))->format('M j, Y'); As dumb as it may sound given the length of this statement versus requinix and Barand's answers, this is easier for my brain to read.
  12. That's still not making a whole ton of sense. The original code you've posted is using fetch to call to a php script, which I assume is pulling data from a database. It's presenting that data as an array - there's really no getting around that. One way or another you'll need an iterable interface in order to loop through the dataset to present the data. An array is the most convenient way; you could json-encode the data before php outputs it so that it comes across as an object in javascript, but really the way it's being used here that's mostly semantic. It sounds like there's something else going on that we don't know; is there caching involved? Like Redis or Memcached? Explain what goal you're trying to achieve, not how you want to achieve it.
  13. You can also switch to PDO and get the benefits of not having go through extra steps like explicitly binding parameters (you can pass an array to PDOStatement::execute). Granted you'll still have to pass it an array that matches the parameters in the query, but it's less typing. There are also other reasons to move to PDO; the simplified interface and much easier readability, for example.
  14. Not gonna lie, I have no idea how they do it. In my experience though, even large corporate entities that are respected in the field like MC or CC the results are just kind of assumed to be legit. An agency I recently worked with was adamant about pointing out to clients that it couldn't guarantee specific numbers on email opens, reads, or deletions because the numbers were at best kinda reliable... I assume the big players have some sort of sway with major email providers, but I have no proof of that. Obviously tracking results of clicks from the email to the website are more reliable as you simply append the tracking parameters to the end site from the email to the URL in the email itself. Doesn't help with opens, though - sorry. I have to assume someone here is more knowledgeable than I on the subject.
  15. Your best bet here is to use an email service. SugarCRM, Constant Contact, MailChimp, etc. all provide the tracking you're looking for - how reliable it is is always kind of a debate, but they are the standards.
  16. Honestly, if you want fancy tooltips I'd recommend using Tippy - super easy and powerful.
  17. Things you'll need to do to get help: Describe what the code should be doing Describe what the code is doing instead Show us any errors you're getting in your browser Show your relevant code If it seems like the error could be a database problem, describe the data and its structure Explain what you've done so far to fix the issue(s)
  18. Do you have a question?
  19. To elaborate on requinix's point, JavaScript is client-side. That means it runs in the browser, so - for example - if the user clicks on something JavaScript can catch that action and do things to the elements currently on the loaded page without reloading that page in the browser. PHP on the other hand runs on the server, so the page needs to be refreshed so the data gets back to the server and can be acted upon. If you want to run a server-side process from the client, you'll need to use AJAX (today, the fetch() JavaScript function) to send the client-side information to the server for processing.
  20. I should hope you hash the password value before putting it into the database - right now you're doing a plain-text compare. Also, is the name of your submit button actually 'submit ' (note the space at the end). Are you getting an error message or is the script just always showing the login form? Perhaps using a few words to describe what's happening would help us to help you.
  21. What error are you getting? Your flow looks pretty standard and mostly correct, so post some code - please use the <> button to do that.
  22. The height and width on .update-card is just there to see the effect. You can remove them and add some padding to the div to make it dynamic.
  23. Using the markup in the thread and this CSS .update_card{ width: 300px; height: 100px; background-color: red; } .update-list{ margin: 20px; border-radius: 10px; overflow: hidden; width: fit-content; display: flex; flex-direction: column; row-gap: 20px; } give me this It looks like that's what you want?
  24. Echo it out and see. echo __DIR__;
×
×
  • 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.