Accessing email content using NetPop3

July 19th, 2010 | Php

NetPop3 is a class to allow access to POP3 servers. It supports all POP3 commands including UIDL listings and APOP authentication.

Download the package first at http://pear.php.net/package/Net_POP3/download

Create a php file and include the NetPop3 at the beginning of the file

include 'POP3.php';

Read more…

What is T_PAAMAYIM_NEKUDOTAYIM?

February 9th, 2010 | Php

It is a scope resolution operator that can be found in Php. Paamayim Nekudotayim in Hebrew means “twice colon” or “double colon”.

Cannot upload in mac web server using php

February 4th, 2010 | Php

I bought a macbook last december 2009 and transfer my files from my windows laptop. After the the transfer, the first thing I did is to browse the projects that I’ve done. While browsing, I came across a page where in there is a file upload facility. Then I started to upload a file. While uploading, it suddenly popped an error. Then I checked the folder I used to put the file uploads and found out the file is not there. What could be the solution? It’s the upload_tmp_dir found in the php.ini. Just make sure that the folder path where you put the uploaded file is specified.

mysql_num_rows() VS mysql_affected_rows()

February 4th, 2010 | Php 1 Comment »

Whats is the difference between mysql_num_rows() and mysql_affected_rows()? mysql_num_rows() is used together with select statements while the mysql_affected_rows() is used with update, delete and insert statements.

An example of mysql_affected_rows().

$result = mysql_query( "INSERT INTO mysqltable
								VALUES( NULL, '$value' )" );
$rows = mysql_affected_rows();
// returns 1

Read more…

Variable Functions

February 4th, 2010 | Php

Using a variable to store the returned data of a function. Instead of typing multiple literal function names, just call the variable.

function what_is_my_country( $var ) {
	echo "My country is $var.";
}

$country = 'what_is_my_country';
$country('United States');