-
Posts
1,657 -
Joined
-
Last visited
-
Days Won
51
Posts posted by maxxd
-
-
Given what you've posted, there isn't an action later in the page. You're checking for a value in $_POST, which will be set on page load after clicking a fomr's submit button (assuming that form's action parameter is set to 'post'). So you can check if $_POST['cat_title'] is set at the top of your page and redirect if it is. You don't want to render half a page then redirect a user anyway, right?
-
Basically, business logic was designed and built around data being in the store as if it was persistent. Redis was treated as a first-class database and there were portions of logic that would fail catastrophically if the node was unavailable. Technically possible (obviously) just terrifyingly fragile IMO.
-
8 hours ago, NotionCommotion said:
Potential drawback will be lack of persistence upon restarting Redis, but will highly consider using Redis.
Not saying it's a perfect use case, but it does lend itself fairly well. Persistence is always a consideration with Redis, but honestly with ElastiCache for Redis and the like, restarts aren't that prevalent in my experience. That having been said, my last job abused the crap out of Redis so my attitude may be a bit skewed by Stockholm syndrome...
-
You could store usage stats in a Redis hash by user ID, option ID, and number of times selected. Get the top n option IDs per user and grab those from the database. Depending on how often your users interact with the system, you may not even have to crank up the TTL for the hash.
-
In that case, Strider64 has given you your answer. Use JavaScript's test method.
-
7 hours ago, Barand said:
In this situation I like the "null coalesce" operator, ie "??".
Showoff. 😜
-
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.
-
8 hours ago, jasonc said:
I did use the HTML5 but it is not supported on most andriod devices
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.
-
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?
- 1
-
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).
-
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.
-
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.
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.
-
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...
-
14 hours ago, ChenXiu said:
For example if I want to vertically center 3 items in a row and maybe have 2 of those items grouped together on the right, I have to implement an absolutely RIDICULOUS TANGLED mess of nested upon nested divs, floats, or flexes, blah blah blah, when all I need is a good ol' fashioned <table><tr><td>.
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.
-
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.
-
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.
-
6 hours ago, TechnoDiver said:
why is specifying a length required when an index was specifically used
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:
3 hours ago, kicken said:If you don't specify what length, then it defaults to the end of the input string.
Or, as stated in the manual:
QuoteIf offset is negative, the returned string will start at the offset'th character from the end of string.
So, if your $last_number assignment was this:
$last
$last_number = substr($num, -2);
it would also return 27.
-
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.
-
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.
-
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.
-
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.
-
../user/dbconfig.php outputs something - check that file.
-
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.
-
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.
- 1
Why is my Flex Direction not working on this demo page?
in CSS Help
Posted
Hidden text could be seen as keyword packing by search engines, and can hurt your ranking.
WP Bakery is a paid plugin, so I'd honestly be a bit surprised if it doesn't do what it claims. The problem could be over-nested elements or, as requinix stated a couple times, the class is assigned to the wrong container element. If it truly doesn't handle the issue, request your money back and be vocal if the author gives you any guff about it.