In php default session time is 24 min. You need to make changes in php.ini for change it.… Read more
Steps for the payment gateway processing?
An online payment gateway is the interface between your merchant account and your Web site. The online payment gateway allows you to immediately verify credit card transactions and authorize funds on a customer’s credit card directly from your Web site. It then passes the transaction off to your merchant bank … Read more
How can we redirect a PHP page?
Using php function: header(“Location:http://www.phpprogram.net”);… Read more
List out different arguments in PHP header function?
void header ( string string [, bool replace [, int http_response_code]])… Read more
What type of headers have to be added in the mail function to attach a file?
$boundary = ‘–‘ . md5( uniqid ( rand() ) );
$headers = “From: \”Me\”\n”;
$headers .= “MIME-Version: 1.0\n”;
$headers .= “Content-Type: multipart/mixed; boundary=\”$boundary\””;… Read more
What is the difference between Reply-to and Return-path in the headers of a mail function?
Reply-to: Reply-to is where to delivery the reply of the mail.
Return-path: Return path is when there is a mail delivery failure occurs then where to delivery the failure notification.… Read more
How to store the uploaded file to the final location?
move_uploaded_file ( string filename, string destination)
This function checks to ensure that the file designated by filename is a valid upload file (meaning that it was uploaded via PHP’s HTTP POST upload mechanism). If the file is valid, it will be moved to the filename given by destination.
If filename … Read more
What is type juggling in php?
PHP does not require (or it support) explicit type definition in variable declaration; a variable’s type is determined by the context in which the variable is used. That is to say, if a string value is assigned to variable $var, $var becomes a string. If an integer value is then … Read more
Connection to the MySQL Server using PHP
Before access data in a database, we must open a database connection to the MySQL server.
In PHP, using the mysqli_connect() function.
mysqli_connect(host,username,password,dbname);
$con=mysqli_connect(“example.com”,”user01″,”password”,”my_db”);// Check connection
if (mysqli_connect_errno())
{
echo “Failed to connect to MySQL: ” . mysqli_connect_error();
}
Create Database using MySQL and PHP
The CREATE DATABASE statement is using to create a database table in MySQL.
The following example creates a database named “my_db”:
$con=mysqli_connect(“example.com”,”user01″,”password”);
// Check connection
if (mysqli_connect_errno())
{
echo “Failed to connect to MySQL: ” . mysqli_connect_error();
}
// Create database
$sql=”CREATE DATABASE my_db”;
if (mysqli_query($con,$sql))
{