Insert data using ajax into mysql database

This example will guide you how to insert data into mysql database using AJAX and PHP.

Follow the below steps :
1). Create a file named ‘form.php’ and copy and paste the below code into it.

2). Create a new file named ‘insertdata.php’, copy and paste the below code into it. This is the code used for inserting data into mysql database.

3). Copy and paste the below code in the ‘form.php’ under head tag :

Note : This script requires the ‘jquery.min.js’ to be included before the ajax request code.

Now, the complete code would be

That’s it,┬ácustomize the code as per your requirement and enjoy.

Encryption and Decryption in php

Encryption is the process of translating plain text data (plaintext) into something that appears to be random and meaningless (ciphertext). Decryption is the process of converting ciphertext back to plaintext.

To encrypt more than a small amount of data, symmetric encryption is used. A symmetric key is used during both the encryption and decryption processes. To decrypt a particular piece of ciphertext, the key that was used to encrypt the data must be used.

In this post we will show you how to encrypt and decrypt any string in php. We will use two function one for encryption and second for decryption. There will be need to set a key for both functionality. The code which needs to be decrypted should must be encrypted by the same key used in encryption.

Find the code below for both Encryption and Decryption.

Code for Encryption

Code for Decryption

That’s it, Send the fresh keyword for encryption as key value in encrypt function which will provide the ciphertext value then when you need to decrypt the same encryted string Pass the encrypted string to decrypt function to get the original string.

Convert currency to Bitcoin in php

About Bitcoin

Bitcoin is both a cryptocurrency and an electronic payment system invented by an unidentified programmer, or group of programmers, under the name of Satoshi Nakamoto. Bitcoin was introduced on 31 October 2008 to a cryptography mailing list, and released as open-source software in 2009. The identity of Nakamoto remains unknown, though many have claimed to know it. The system is peer-to-peer, and transactions take place between users directly, without an intermediary. These transactions are verified by network nodes and recorded in a public distributed ledger called the blockchain, which uses bitcoin as its unit of account. Since the system works without a central repository or single administrator, the U.S. Treasury categorizes bitcoin as a decentralized virtual currency.
Read More

How to create a file using php

In this post you will learn how to create a file using PHP. In PHP, a file is created using a command that is also used to open files.

In PHP the fopen function is used to open files. However, it can also create a file if it does not find the file specified in the function call. So if you use fopen on a file that does not exist, it will create it. Read More