Jump to content

maxxd

Gurus
  • Posts

    1,725
  • Joined

  • Last visited

  • Days Won

    57

Everything posted by maxxd

  1. It sounds like you're using procedural programming, in which case I'd go with defining the variables as you need them. If you're using OOP I recommend defining any class properties at top of the class, before the constructor - with PHP it's not technically necessary, but I find it cleaner. As far as the use of isset() on null or == "", try empty(). empty() returns true if the variable is false (which null and "" equates to) or if the variable doesn't exist, so it covers all your angles with one check.
  2. I don't know exactly what you mean by this, but android supports HTML 5 semantic markup. If you want to make sure the email actually exists, I believe there are services that can do this. I've not used one so I can't vouch for the accuracy or operation, but a Google search should return some good places to start.
  3. From the Laravel documentation: $flight->name = 'Paris to London'; $flight->save(); From your code: $data->image=$request->image; $data->save; Do you see the difference?
  4. It looks like you're mixing versions of CodeIgniter - version 3 used load() while version 4 uses namespaces. I'm pretty sure there's an upgrade doc somewhere (it's been a bit since I've worked with CI so I don't remember specifically).
  5. What you're describing sounds like a FOUC (Flash Of Unstyled Content) and is usually caused by any or all of a few things: Slow-loading (typically remote) stylesheets Stylesheet links at the bottom of the page instead of in the head Javascript styling Does your site use jQuery or Google Fonts, for instance? I've had this issue pretty consistently with Google Fonts or Adobe Font Kit.
  6. 1. Honestly, no idea. I feel like at some point back in the day I made vertical-align work, but I haven't thought about it for so long that I have no idea how. 2. flex or grid 3. There's nothing wrong with the code you've posted, and using flexbox will get you the result you want. You just need to adopt it - there's not a browser available that can't handle it natively at this point and as you've clearly seen, the struggle is real without it.
  7. Additionally - grid is also fantastic, but in my experience a bit more difficult to wrangle. Grid and flexbox are pretty much made to be used together and can do most anything...
  8. Yeah, you want flexbox. There's also the idea that HTML should be semantic and a table should be used for tabular data output only. I don't know for sure that Google penalizes non-semantically correct HTML because Google prides themselves on not letting anyone know how they rank sites, but anecdotal evidence points to that being the case.
  9. Agree. I personally find Firefox dev tools easier to read and work with, but Chrome and Edge tools (given that they're pretty much the same) are certainly not bad. For PHP though, you're probably going to want to look at XDebug or something similar - browser dev tools are built to handle what happens in the browser, not on the server.
  10. Available at all on a select date or available within a given time frame on a select date? If the only spec is that there are no other appointments or events on that person's calendar on that specific date, that's a simple question of a subquery where select all events on date are null. If you're talking time, that gets complicated with start times, end times, and overlaps of either or both.
  11. Just to avoid any confusion as it's not clear if you're referring to your $first_digit or $last_digit assignment, your second line will assume the third parameter is the length of the string - as kicken pointed out: Or, as stated in the manual: So, if your $last_number assignment was this: $last $last_number = substr($num, -2); it would also return 27.
  12. Put your config file outside the document root, so put the file at /opt/lampp/config/config.php, then use require_once $_SERVER['DOCUMENT_ROOT'].'../config/config.php'; in your code.
  13. JavaScript isn't going to set your PHP variable; $filePath is set somewhere earlier in the PHP file. Find that line and post it here.
  14. I just want to point out that AD and MVC aren't mutually exclusive. Laravel, for instance, is an MVC framework with a built-in AR ORM (Eloquent). Patterns intermingle and build on each other to create a full code base, so you don't need to discount or dismiss AR if you decide to use MVC, and vice-versa.
  15. I'll lay good money Barand is spot-on. Don't close out your php files - if there's a trailing newline it'll be regarded as output to the browser, and some editors add a newline by default on save.
  16. ../user/dbconfig.php outputs something - check that file.
  17. It's a shorthand for if:else called a ternary operator. You'll have to scroll down the link for the full explanation as apparently there's not a name link there. Your reading of the line is correct, yes - a checkbox variable will only exist in $_POST when it's checked; so if it's checked and equal to 'a' $score will be 1, otherwise $score will be 0.
  18. I use docker for all my setups. Base your image on the official PHP image and go from there. Complete portability, as long as the host machine has docker installed.
  19. Your connection string is incorrect. Also, turn on error reporting either in the script or (preferably for local development) in the php.ini.
  20. Wrap your entire page structure in a div, give it display: flex, flex-direction: column, and min-height: 100vh. Give the header and footer a max-height and flex-grow: 0, then assign the body div a flex-grow: 1. Sticky footer with dynamic page height, and unless you're still supporting < IE 9, should be pretty universally cross-browser by now.
  21. You're missing a semicolon on this line: $data[$topic_parentid][] = array('id'=>$topic_id, 'name'=>$topic_title) $data[$topic_parentid][] = array('id'=>$topic_id, 'name'=>$topic_title)
  22. Gotcha - I didn't read everything correctly. Thank you!
  23. Legit question - does https://www.php.net/manual/en/datetime.gettimezone.php not handle that?
  24. I'm not entirely sure what you're trying to accomplish with everything after the mysqli_query (also, you may want to look into PDO as it's much easier), but what does this give you: die("<pre>".var_export($result, true)."</pre>"); if you put it right after the mysqli_query line?
×
×
  • 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.