Tag: php


Installing xdebug in XAMPP 5.5.19 on Mac OSX

This was tested on OSX Lion. Please let me know if it works on Mountain Lion or later. Here is what we will be doing in a nut shell. You will need to download the correct source code for your version of xdebug and then you will need to use the correct...

Don't insert when maximum is reached

How to control if a record is inserted based on a condition? Don't insert a record if certain conditions are not met. There is a way of using pure MySQL to stop inserting records when a certain number of them has been reached. Let us say that you have...

Installing xdebug in XAMPP 1.8.3 on Linux

If you have installed XAMPP 1.8.3-0 for Linux and you want to install x-debug here is how to do it using PECL. 1.) Check to make sure /bin is in your path echo $PATH; if :/bin: is in the path then bin is in your path. This makes sure that when you c...

Compare the contents of a remote directory with a local directory

Here is a little PHP script I wrote, that you can run from the command line. I wrote it to allow you to see what files are in a remote folder that are not in a local folder. user@localhost the_directory> php compare.php the_host_address.com:/the/remot...

Using Table Names With Spaces in PHP and mySQL

The key to writing SQL queries using table names that contain spaces is to make sure you use the correct quotes.This is wrong:SELECT * FROM tablename ORDER BY ''field name'' ASCThis is correct:SELECT * FROM tablename ORDER BY `field name` ASCThese (`) ...

Unix style options and flags with command line PHP

Looking for a more intelligent way to parse in options from the command line into your PHP script other than $argv? For example, you may want to be able to place options in any order like the following: php somescript.php -pv -o value or php somescr...

Parse a date by a specific date format in PHP

In the name of code readability and functionality, if you want to parse a date of a certain format you should do it in a way so that other programmers that look at your code can tell what you were doing. Here is a way as of PHP >= 5.3.0 to parse a st...

Increment date by one day | < PHP 5.2

If you want to increment a date by one day you need to do it using the PHP DateTime function so that you can account for leap years. date_default_timezone_set('UTC'); $time_stamp = strtotime('0000-00-00 00:00:00'); $date = new DateTime(); $date->setTi...

Generate a list of dates between two dates in PHP

If you want to create a list of dates between two different Unix time stamps, here is how to do it: //2001-09-09T01:46:4 $starting_unix_timestamp = 1000000000; //now $ending_unix_timestamp = time(); date_default_timezone_set('America/Denver'); $st...

Interpret PHP as you type | PHP prompt

How to Code PHP from the prompt. How to run PHP in interactive mode. Open a command line prompt and type the following: C:\> php -a Interactive shell php > echo 5+8; 13 ctrl-D to exit If it can't find PHP, you need to check and see if it is inst...

Hide a block on all admin pages | Drupal 6

There are two main ways to do disable a certain block on all admin pages. The first way involves using the administrative tools provided in the backend. The second uses custom script. -----------------------------------option 1 ---------------------...

Merge documentation | Mailchimp | Drupal

If anyone has more complete information on this subject please comment below. If you installed the drupal MailChimp Module you might want to know how to "Merge Variables" If you were like me you created a list on mailchimp Added the Drupal M...