Latest posts to the library
Categories: Article, php | Add a Comment

Quite often you may need the ability to check what type of data type a variable is. In most programming languages this is possible to do and is usually called typeof(). PHP too has a way to check this, it is called gettype() and it’s so simple to use. All you have to do is [...]

In the below example we will use Actionscript 2 to call a remote PHP file that will return data to it. It is a simple way of transferring data between the server and client. Actionscript 2 Code: callRemoteFile = function(ourVariable:String) {         var result_lv:LoadVars = new LoadVars();     result_lv.onLoad = function(success:Boolean) [...]

Categories: php | Add a Comment

If you would like to show random numbers using PHP you can do this: <?php         $min = 1;         $max = 100;         $total = 100;         $arrItems = array();         while ( count($arrItems) < $total ) {   [...]

Categories: bug, html, php | Add a Comment

$to = "email@address.com"; $subject = "SUBJECT"; $message = "<b>MESSAGE</b>"; $headers = ‘MIME-Version: 1.0′ . "\r\n"; $headers .= ‘Content-type: text/html; charset=iso-8859-1′ . "\r\n"; $headers .= ‘From: Mailer ‘ . "\r\n"; mail($to, $subject, $message, $headers); The above code does not always send emails in HTML as it should, it turns out there is a PHP Bug (http://bugs.php.net/15841) [...]

Categories: Article, php | Add a Comment

Below is a Mail class I created in PHP, it requires 4 arguments on initiation of the class via the constructor and uses the method ->send() to send the created mail once complete. class Mail {         var $to;         var $subject;         var $content;   [...]

Categories: error, php | Add a Comment

Getting “Parse error: syntax error, unexpected T_IF” ? Check if the preceeding line ends with a ;

MySQL Main Query Types SELECT SELECT * FROM tablename INSERT INSERT INTO tablename (col1, col2, col3,..) VALUES (val1, val2, val3,…) UPDATE UPDATE tablename SET `col1`=`val1`, `col2`=`val2`, `col3`=`val3`,… DELETE DELETE FROM tablename WHERE `col4`=`val6` Note You will use a lot of WHERE clauses as well along with the above. e.g. SELECT * FROM tablename WHERE `id`=’15′ [...]

Categories: mysql, php | Add a Comment

If you need to connect to a mysql database from php you can do it like this: <?php>    $DBH = ‘localhost’;    $DBU = ‘root’;    $DBPWD = ‘password’;    $DBN = ‘petstore’;    $conn = mysql_connect($DBH, $DBU, $DBPWD) or die  ("Error: Could not connect to database.");    mysql_select_db($dbname); ?> This allows you to [...]

Categories: Interesting, php | Add a Comment

I think this may be the fastest way to get a list of all the directories in a given folder/directory using PHP. $directories = array_filter(glob(‘*’), ‘is_dir’); ..and of course you can also add a path to it if you need to: $directories = array_filter(glob($myPath.‘*’), ‘is_dir’);



back to top