-
Posts
15,229 -
Joined
-
Last visited
-
Days Won
427
Everything posted by requinix
-
strtotime() is interpreted differently on different servers
requinix replied to MockY's topic in PHP Coding Help
MockY, I don't think so. Personally I don't like relying on strtotime() when there are simpler more straightforward methods. The last day of this month can be just date("Y-m-t") // as I posted beforeLast day of next month can be date("Y-m-d", mktime(0, 0, 0, date("n") + 2, 0)) // day #0 of two months awayor if you don't mind the Y-m-t trick date("Y-m-t", mktime(0, 0, 0, date("n") + 1, 1)) // day=1 guarantees no wrapping -
html- post to php and get data in gzip deflated
requinix replied to abhivinay's topic in PHP Coding Help
Wow, yeah, you really aren't elaborating on any of this. But okay. <?php ob_start("ob_gzhandler"); switch ($_POST["user"]) { case 8104: echo " test 123 test 456 test 789 "; break; case 8105: echo "test 321 test 654 test 987 "; break; } -
Tip: strtr can do a bunch of replacements using an associative array, like array( "first" => "1", "JULY" => "7",[edit] And if you're always converting to a number then you can save yourself some repetition by1. Converting the string to all upper- or lowercase (don't need a "july" and "JULY") 2. Using iconv() to "remove" accents from characters (don't need a "ventitre" and "ventitré")
-
CLI is "command-line interface". It's Windows' Command Prompt and *nix's terminal/console, and SSH gives you remote access to a CLI. You may need to find yourself a quick primer on them before you continue.
-
Detect if link opened in new tab or window or direct url access
requinix replied to pintee's topic in PHP Coding Help
Change your AJAX URL to something like /page2.php?ajaxthen redirect if !isset($_GET["ajax"]). Yes, it does mean that someone could go to "page2.php?ajax" to see the page without a redirection, but it is not possible to strictly allow AJAX only - this is basically as close as you can get. -
strtotime() is interpreted differently on different servers
requinix replied to MockY's topic in PHP Coding Help
With 05-31 + 1 month you get 06-31, which wraps to 07-01. date(Y-m-t) from that will give you 2013-07-31 because t=number of days in the month. The actual Y-m-d date is just 2013-07-01. Using "last day of" changes the arithmetic so it only uses the last day of the month: 2013-05 + 1 month is 2013-06 and the last day is 2013-06-30. -
Not sure what you're saying. Are those attributes indicating what type of data is contained by the element? What elements are available? Or what's the XML?
-
strtotime() is interpreted differently on different servers
requinix replied to MockY's topic in PHP Coding Help
I wouldn't at all be surprised if it was a version difference - anecdotally, strtotime() has fluctuated a bit since 5.3.0. But consider using date('Y-m-t')instead anyways -
Detect if link opened in new tab or window or direct url access
requinix replied to pintee's topic in PHP Coding Help
Include a special flag in the AJAX URL so you know the request is coming from the AJAX and not a normal request. If it's not present then redirect. By the way, what you're doing is horrible. How am I supposed to bookmark a page on your site? Link it to friends? Search engines will absolutely hate it. -
It helps because what you're literally asking for is impossible. You need to find another way - like with an associative array.
-
I forget exactly why but some servers will do reverse lookups on you. That can take a few seconds. Manually connect with telnet and see what the server is doing.
-
With arrow -> notation, think of it like there can be only one "active" namespace at a time. children() can switch the active namespace, like with $entry->children("cap", true)->event There should be a feature request somewhere to allow variable-variable notation with namespaces, like $entry->{"cap:event"}(which doesn't work now).
-
Nope. It's not supposed to be very flexible: just a list of tables (and maybe views).
-
Don't fetch associatively?
-
preg_match returns Notice: Undefined offset
requinix replied to iamLearning's topic in PHP Coding Help
false !== $resultpreg_match() returns a number corresponding to how many matches were found (ie, 0 or 1). It never returns false. Embrace the loose typing. if ($result) { -
Given a few minutes of thought you should be able to guess what to do. How do you think it should work? [edit] Seriously? s and s?
-
He calculated the "average" to be over the number of arrays, not the number of inputs. (7.50 + 9 + 4.50 + 6.50 + 3.75) / 3 arrays = ~10.42 per array
-
Retriveing column name for db with whitespace
requinix replied to budimir's topic in PHP Coding Help
Okay, rephrase: What does print_r($row);output? -
If it's not deleting it (them) then there's probably an error message (or four)... You're sure the "image" from the form is actually "users/Admin/photos/1334.jpg"?
-
Retriveing column name for db with whitespace
requinix replied to budimir's topic in PHP Coding Help
What is the actual contents of $row? -
I am so not inclined to help you since the only effort you've shown here is that you can copy/paste entire posts from another forum. You didn't even bother to copy only the text. But it's a very easy answer so I will anyway. Bound variables don't work like simple string replacements. If you want to LIKE a field against a bound string then the string has to be the entire expression - %s and all. $tok = "%" . $tok . "%"; AND evento.titolo LIKE ? OR evento.sottotitolo LIKE ?
- 3 replies
-
- mysqli
- mysqli-prepare
-
(and 3 more)
Tagged with:
-
That was confusing. You're saying result.add is that array? Or is a string containing the JSON for that array?