CONTACT @ Skype : rajdimdung   |   call : +977 9841813550

AJAX PHP Example

Post by : Raj Dimdung    Date : 2015-03-07 06:05:33

The following example will demonstrate how a web page can communicate with a web server while a user type characters in an input field:

Start typing a name in the input field below:

First name:  


Example Explained

In the example above, when a user types a character in the input field, a function called "showHint()" is executed.

The function is triggered by the onkeyup event.

Here is the HTML code:

Read More

Basic PHP mail() Function code to send emails from a form

Post by : Raj Dimdung    Date : 2014-12-05 08:51:35

You can use the PHP mail() function to send an email with PHP. The simplest way to do this is to send a text email. This is one way to handle sending you the results when a visitor to your website fills out a form.

Important! : From localhost this may not send email, So set SMTP URI in php.ini or header of script file.

Basic PHP email() fuction code

Below is the code for the baic email function. We can take the script and actually use a form on our website to set the variables in the script above to send an email.

Read More

Open a Connection to MySQL

Post by : Raj Dimdung    Date : 2014-11-29 04:11:41

Open a Connection to MySQL

$servername = "localhost"; // host name server name
$username = "username"; //dataabse username
$password = "password"; // database password

// Create connection
$conn = new mysqli($servername, $username, $password);

// Check connection
if ($conn--->connect_error) {
    die("Connection failed: " . $conn->connect_error);
echo "Connected successfully";

Read More

PHP Connect to MySQL

Post by : Raj Dimdung    Date : 2014-11-29 03:57:47

PHP 5 and later can work with a MySQL database using:

  • MySQLi extension (the "i" stands for improved)
  • PDO (PHP Data Objects)

Earlier versions of PHP used the MySQL extension. However, this extension was deprecated in 2012.

Should I Use MySQLi or PDO?

If you need a short answer, it would be "Whatever you like".

Both MySQLi and PDO have their advantages:

PDO will work on 12 dif

Read More