PHP Php Display only number of characters from string This is an example to display only 13 characters from a string: $string = (strlen($string) > 13) ? substr($string,0,10).'...' : $string;
PHP Execute Windows Batch File from php If you ever needed to execute a batch file from php, you run it as : system ("cmd /c C:/path-to/file.bat");
PHP Installing PHP Time Zone Database Instead of relying on system time zone database, you can use php timezone database which gets updated more frequently. Here is how to do that : pecl install timezonedb If you do not have pecl command installed ( For Eg. Centos ) Run the following command : php /usr/share/php/peclcmd.php install
PHP cannot start session without errors Web server is not able to access your session directory. Change the permissions. chown -R root:apache /var/lib/php/session
MSSQL Accessing Microsoft SQL Database from Linux Boxes In order to use Linux & MSSQL with php , we need to install a TDS driver which is Tabular Data Stream Protocol. yum install freetds /usr/bin/tsql -S [mssql server name or ip] -U [username] locale is “en-US.UTF-8″ locale charset is “UTF-8″ Password: [type your password] 1>
PHP Import CSV file to database using PHP Below is the code snippet that will let you import CSV file into database using PHP : \n"; if(mysql_error()) { echo mysql_error() ." \n"; } } ?>If the data is something like this: "name","userid" "john","jon" I only had