Whenever I work with PHP (often) I typically work on a Windows box, however I (try to) develop platform agnostic applications; one major point of issue being the use of directory separators. As many …
Tag: php
PDO connection works from command line, but not through Apache?
I have a very simple test script: When I execute this script from the command line, it works perfectly: But when I access the exact same script through my web browser, it says: I’ve tried var_dump on the error, and the message is: “SQLSTATE[HY000] [2003] Can’t connect to MySQL server on R…
Modulus in a PHP loop
I’m currently checking whether an entry in a loop is the third iteration or not, with the following code: How can I check if the loop is in its second and not its third iteration? I have tried $i % 2 == 1 to no avail. Answer Modulus checks what’s the leftover of a division. If $i is 10, 10/2
why are arabic numbers (١٢٣) not accepted in textboxes as real numbers?
while developing one of my sites, i noticed that if I enter arabic numbers (١٢٣), they are not interpreted as real number values. Then, I tested a few other sites only to find that they also don’t accept arabic numbers. The problem is, my client seems to require this functionality (accepting arabic numb…
Altering Title on Drupal Node Delete Confirmation Form
When you attempt to delete a node in Drupal, you’re taken to a confirmation page whose title is… Are you sure you want to delete {title of node}? I’m attempting to alter the title of this page …
Validating UK phone numbers in PHP
I purchased a contact form. Great little thing but I need to convert the validation for the phone number to allow for UK number formats – in other words, to allow for spaces. Right now it validates …
Check If array is null or not in php
I have an array like below which is generated by parsing a xml url. The array is Array ( [Tags] => SimpleXMLElement Object ( [0] => ) ) The array name is $result. Now …
PHP function missing argument error
My validate function looks like that Function call example As you see, my validate function has 3 input vars. I’m not using second var – $data2 often, that’s why set it to 0 by default. But when I’m calling this function as given example (as far as I know it means $data=$lname, $data2=…
Get current date, given a timezone in PHP?
I want to get todays date given a time zone in Paul Eggert format(America/New_York) in PHP?
hiding the URL address in the address bar
I want to hide the url of the address bar but i have no idea how to do it, i have done some searching but found nothing. On my website i want people to just see www.roundaboutmk.com on every page, no matter what link/button they click on. for example, if they click on the “login” button it will ta…