-
Posts
15,229 -
Joined
-
Last visited
-
Days Won
427
Everything posted by requinix
-
You don't want to put it inside the table cell?
-
A line break is a <br>.
-
Failure to chown() is just a warning so it won't stop the script. However that does mean (a) the warning is not being recorded in a log somewhere, or (b) it is and you haven't looked there yet... Additionally, if the script chmod()s then it may not be taking into account the umask, which typically only strips write permissions from the Group and Other masks but could be set to something stricter for you. If Apache can't read the file then it must be owned by a different user and/or group, and there aren't read permissions. (Or it could be a missing exec bit on the directory, but if Apache can read other files in it then that's not the issue.) So go into the terminal and verify for yourself exactly what user and group owns the files and what the permissions are. You should also confirm exactly what users and groups Apache and PHP are running as.
-
Persisting an object over multiple requests
requinix replied to NotionCommotion's topic in PHP Coding Help
You're reinventing caching. Set yourself up a redis or memcached server and store stuff in there. -
First step to understanding why something doesn't behave as it should is to know how it's supposed to behave. Why is that correct? Are you implying a delivery time of 1 day? Thus today (Tuesday the 18th) + 2 days of a delay before sending + 1 day of delivery = 3 days from now (Friday the 21st)? What is $off? Is $standard_days the number of business days for delivery? $saturday is apparently whether final delivery can happen on a Saturday but does that also allow mean Saturdays count towards delivery progress? Is $delay in fact some sort of pre-shipment time or does it mean something else? In other words, how is this function being used?
-
0775 means your file is an executable. Is it an executable? 0644 should be fine. PHP can't change ownership of a file unless PHP is running as root. It isn't, right? Have you seen yourself that the file is owned by http:http, or is that just what the code tries to do?
-
Unless you think you can get an official answer from the Gmail team about why some emails were spam and some weren't, you're going to have to settle for my answer of "it varies by account".
-
Yeah. It's called "some people think these emails are spam and some people don't". There is no absolute truth about what constitutes spam. It can vary by account.
-
Start with an empty array where you will store everything. Use explode() to split the whole textarea string into an array of all the lines. Then use a loop to go over all those lines. Split each line into a name and a country. Check if the empty array from before has an entry according to the country. If it does not, add it as a (sub) array. Append the name to that (sub) array. Try writing the code for that. If you have problems, post what you wrote.
-
How do I change this Select Statement to $pdo->query
requinix replied to larry29936's topic in PHP Coding Help
Ohhh... yeah. Okay. This makes sense now. A (start, end) key finds the start quickly but the end is only useful for an exact match of a start value. Which is useless for the second half of a BETWEEN. And the lone end key won't do anything useful. So you have to do it in two pieces. I was thinking the (start, end) would somehow work for finding an end given an initial position located by the start value, but that's totally wrong. -
It doesn't matter what the domain is. It's just an email address.
-
It depends on the service. I don't think you can safely change everything: some of them may use the same mail system for all of the domains, some of them might not. What's wrong with the original email addresses? Why do they have to change?
-
How do I change this Select Statement to $pdo->query
requinix replied to larry29936's topic in PHP Coding Help
That's quite a difference. What does the EXPLAIN say? I would think they should be the same: index scan to find the start, index scan to find the end, return everything (which should be just the one row since ranges don't overlap). -
Going to need more information than that. What are these emails? Where are they coming from? Why are they so mixed up if you don't want them to be? Why are you trying to change them to be from different domains?
-
How do I change this Select Statement to $pdo->query
requinix replied to larry29936's topic in PHP Coding Help
The query I posted won't have that problem. -
How do I change this Select Statement to $pdo->query
requinix replied to larry29936's topic in PHP Coding Help
It's the best way to check an IP address range. But now that I look at the query, it is kinda weird what it's doing. Why is the <= condition inside the subquery but the >= is outside? SELECT id FROM lookup WHERE INET_ATON('$ip') BETWEEN start AND end ORDER BY start DESC, end DESC -
How do I change this Select Statement to $pdo->query
requinix replied to larry29936's topic in PHP Coding Help
You've managed to type non-breaking spaces around the "t". Delete it and type again. Then see if your editor doesn't have some way of turning off typing non-breaking spaces (likely when you hit Shift+space). -
How do I change this Select Statement to $pdo->query
requinix replied to larry29936's topic in PHP Coding Help
If the question is about how to use PDO then that's a PHP matter. If the question is about the query you're trying to run then that's a MySQL matter. But don't worry too much about it. There's a lot of overlap. Worst case is that someone will move the thread to the right place. -
How do I get average user count based on each day?
requinix replied to imgrooot's topic in PHP Coding Help
Are you saying you would set up a loop in PHP of all the dates, and execute that query for each one? -
How do I change this Select Statement to $pdo->query
requinix replied to larry29936's topic in PHP Coding Help
IP addresses are strings. Strings need quotes. Since you've posted this in the PHP forum and not the MySQL forum, I'll mention that you could do the inet_aton work within PHP if you wanted. Numbers aren't strings. -
How do I get average user count based on each day?
requinix replied to imgrooot's topic in PHP Coding Help
First of all, pulling every single user in the table is silly. Your starting query needs to be one that returns to you the join date and the number of users from that date. It'll involve a GROUP BY. Possibly a DATE_FORMAT too, if your join date is actually a join date/time. Once that's ready, Do you care about having the individual day counts too? If so then feed all these numbers into an array and average it. If you don't care about the individual counts then take the query that gets each day, wrap it in a subquery, and in the outer query do an average over it. So the final query is an average of another query. -
That is silly. Unless there is something important that you haven't described, there is absolutely no reason whatsoever to use Javascript to disable an element (no less to disable it using a mouseover event) when you could be using your PHP to output a textbox that is already disabled. You know that you can mark a textbox as disabled within its HTML. You know how to check a condition in PHP. I don't understand where the difficulty is in combining those two together to get a disabled textbox when some variable has some value.
-
Did you do the other part of what I said in my post?
-
You can use variable variables syntax to get to it. echo '<td>' . $xmlLineItem->{"detail.description"} . '</td>';
-
Does the XML actually say <detail.description>?