Connect PHP with MySQL database, execute queries to manipulate information and retrieve data and display it using MySQL. Connecting with a MySQL database using PHP requires the use of three functions mysql_connect() mysql_select_db() and mysql_query() In this article I’ll be explaining how to connect to a MySQL server, create a database, create a table, insert values into it and retrieve it to display it in the form of HTML tables.Continue Reading…
List of PHP Timezones
The timezones listed here can be used with your php.ini file or htaccess file. To learn how to change your PHP time zone setting read Setting a Timezone in PHP.
This is a complete list of PHP supported timezones taken from the official PHP websiteContinue Reading…
PHP include() vs require()
If there is one feature that is highly useful and used by novices and experts alike its SSI (Server Side Includes). It reduces the need to copy paste repetitive code and you get a cleaner code. PHP has two functions for including files include() and require(). There is a lot of confusion on which to use when because both of them basically perform the same function of including the specified file but the difference comes by how they handle files.Continue Reading…
Using Sendmail on Windows
The PHP mail function is a wonderful feature of PHP but like all good things in life this function also has many drawbacks. On a Linux platform it requires sendmail to be installed, but coming to windows a SMTP server is needed to send email. So if you take a peak inside the php.ini file you’ll find the following line
[mail function] ; For Win32 only. SMTP = localhost smtp_port = 25
But the limitation here is you can only specify the SMTP server name and port, if the server requires authentication there is no provision for specifying the username and password. So unless you have a mail server configured to send local email without authentication there is no way to use the php mail() to send emails.Continue Reading…
How to use custom php.ini files on shared hosting
The advantages of using php with apache web server are many. The wonderful file named .htaccess makes things easier by allowing the webmaster (thats you!) to play around with many settings which would otherwise need the php.ini to be edited. This is a boon for people having their websites hosted on a shared server. Such people can’t even dream of editing the php.ini file located on their web hosting provider’s server. Thus the concept of custom php.ini was born. Webmasters who have their website hosted on a server with support for custom php.ini can create a php.ini within their directory and provide all the necessary settings they require. But custom php.ini doesn’t work out-of-the-box. This article explains how to use custom php.ini on a shared hosting server.Continue Reading…
Setting a Timezone in PHP
Using the javascript date/time function is easy because its a client-side language so it displays your system time. But its not the same case with PHP. Since its a server-side language it displays the server’s time which can be irritating because you might have your server located in another country and you might live somewhere else. But changing the timezone is just a few clicks away and whats more, you can even set different timezones for different pages/directories.Continue Reading…