LOAD DATA
LOCAL INFILE ‘C:/uk.csv’
INTO TABLE myTable
FIELDS TERMINATED BY ‘,’ ENCLOSED BY ‘”‘ LINES TERMINATED BY ‘\n’ (
id,
tableField1,
tableField2,
tableField3
);
SHOW WARNINGS;
How insert data using select query in mysql:
INSERT INTO new_table (date,record_id,data_field)
SELECT date, record_id, data_field FROM old_table
ON DUPLICATE KEY UPDATE date=old_table.data, data_field=old_table.data_field;
//This is our size condition
if ($uploaded_size > 400000)
{
echo “Your file is too large. “;
$okFlag=0;
}
//This is our limit file type condition
if ($uploaded_type ==”text/php”)
{
echo “No PHP files “;
$okFlag=0;
}
// Allow only gif image to upload
if (!($uploaded_type==”image/gif”)) {
echo “You may only upload GIF files. “;
$okFlag=0;
}
// Check the referrer
if (!($domain['host'] == $yourSite || $domain['host'] == $yourSite2) ) {
echo “The referrer is not right. “;
$okFlag=0;
}
//Here we check that $okFlag was not set to 0 by an error
if ($okFlag==0)
{
Echo “Sorry your file was not uploaded”;
}
//If everything is okFlag we try to upload it
else
{
if(move_uploaded_file($_FILES['uploaded']['tmp_name'], $target))
{
echo “The file “. basename( $_FILES['uploadedfile']['name']). ” has been uploaded successfully”;
}
else
{
echo “Sorry, there was a problem uploading file.”;
}
}
We need to edit the httpd.conf in C:\ server\Apache\conf to make sure that Apache knows where is php modules.
Step 1:
Add the following lines at the end of httpd.conf.
LoadModule php5_module “C:/server/php/php5apache2_2.dll”
PHPIniDir “C:/server/php/”
AddType application/x-httpd-php .php
Step 2:
Find this line in httpd.conf.
DirectoryIndex index.html
and add:
DirectoryIndex index.html index.php
Step 3:
Find this line in httpd.conf.
Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from None
Change this to:
Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Step 4:
Find this line in httpd.conf.
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be “All”, “None”, or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
AllowOverride None
Change this to:
AllowOverride All
Step 5:
Find and remove # at the beginning from the following lines
#LoadModule rewrite_module modules/mod_rewrite.so
#ServerName localhost:80
Step 6:
Now create a file php phpinfo, and add the following in the text field:
and save as phpinfo.php and Place this file in the root of your server C:\server\Apache2\htdocs.
Well that is it we setup now PHP in windows.
Step2.
You must include the Windows PATH environment variable by using following steps.
Step 3.
Go to C:\server\php and find the php.ini-recommended. Rename this file to php.ini.
Find the line with extension_dir = “./” and change it to: extension_dir = “C:\server\php\ext”
Find the line with ;session.save_path = “/tmp” and change it to: session.save_path = “C:\server\tmp”
also removing semicolon ; at the beginning.
Find the line with short_open_tag = Off and change it to:short_open_tag = On
Please also uncomment the lines by removing semicolon ; at the beginning of the Windows Extensions of the as needed:
The most used extensions for most php scripts are:
;extension=php_curl.dll
;extension=php_mbstring.dll
;extension=php_exif.dll
;extension=php_gd2.dll
;extension=php_mcrypt.dll
;extension=php_mysql.dll
;extension=php_sockets.dll
Please note enable both the php_mbstring.dll and php_exif.dll DLL’s in php.ini. The php_mbstring.dll DLL must be loaded before the php_exif.dll DLL so adjust your php.ini accordingly.
Step 4
To find out if our PHP is working, from the start menu – run and type cmd. In the command prompt window type php -v. The outcome will be something like this.