You are currently browsing the category archive for the 'PHP' category.
Few day earlier I have a done a project that have Multilanguage supported. It was quite interesting for me. Because it is automatically select your language. Like if you come from Bangladesh then its show bangle and if you come from England then its show English. Just not stop there its show the currency automatically. But I want to give thanks to the phpclasses forum that’s help me a lot to do this project.
Now this article I want to share a little tool of PHP. That tool helps who want to make Multilanguage website. Now a days many site use this Multilanguage option in there website. I write a few PHP code here for how to add Multilanguage options in your site. This gives you an idea. Its very easy code here downloads the codes from here and run into your localhost or your server.
Here I write the PHP code of the language change function that I create.
Here it is,
This code is not enough to run. To make it functionally, download Multilanguagesite.rar and test it into you server. Few more things needed a bangla unicode for change into bangla. And modify the language files and make different your website with Multilanguage support.:-)
At last i start my web programming into ubuntu using lampp. Its really fun. But first Time I’ve a problem to install xampp server. So I start to finding solve of this problem. And I done it. Now I want to share this solution to you.
First You have to download xampp for ubuntu/linux. Then save the installation file into your home folder. Now open terminal & write the following command
————————————————————————————
sudo tar xvfz xampp-linux-1.6.6.tar.gz /opt
————————————————————————————
Then this will extract the file into opt folder.
If extraction complete properly then your installation complete.
For start your xampp server type the following commed
———————————————————
sudo /opt/lampp/lampp start
———————————————————
And stop the server write the command
————————————————————
sudo /opt/lampp/lampp stop
————————————————————
Now enjoy lampp server &-)
Recently I’m working on bangla. The part of this work I learn how to insert & retrieve bangla into MYSQL database using PHP.
Now I’ll discuss the whole process of insert & retrieve bangla into MYSQL database.
It is very easy, we all know how insert & retrieve data from database. Bangla font inserting is almost same. Only two queries are extra needed.
First we have created a database & table using MYSQL to insert bangla.
Now open the mysql command prompt & create database named bangla, & create a table named data.
Now write those command:
- mysql> set names ‘utf8′;
- mysql> create database bangla character set utf8 collate utf8_general_ci;
- mysql> use bangla;
- mysql> create table data (name varchar(100) character set utf8 collate utf8_general_ci);
Insert Bngla into database:
So we create database & table for where we insert bangla font. Now we have to create a simple form where we input bangla word.
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
<html xmlns=”http://www.w3.org/1999/xhtml”>
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=utf-8″ />
<title>Untitled Document</title>
</head>
<form method=”get” action=”bangla.php”>
insert bangla<input name=”name” type=”text” />
<br />
<br />
<input type=”submit” value=”insert bangla” />
</form>
<body>
</body>
</html>
Now just copy the code & save as banglainput.php.
Now insert bangla font into database.
<?php
$cnt = mysql_connect(“localhost”,”root”) or die (“could not localhost”);
mysql_select_db(‘bangla’,$cnt);
//********This Two Lines for bangla*********//
mysql_query(‘SET CHARACTER SET utf8′);mysql_query(“SET SESSION collation_connection =’utf8_general_ci’”) or die (mysql_error());
//*******************************************//
$sql = mysql_query(“insert into data values(‘$_GET[name]‘)”) or die(“error to creating row”);
$results = mysql_query(“select *from data”,$cnt);
echo “the results is “;
while($row = mysql_fetch_array($results))
{
echo $row['name'] .’ ‘;
}
?>
Now copy these code and save as bangle.php.
You must add these two lines just after selecting the database, i.e mysql_select_db() function.
mysql_query(’SET CHARACTER SET utf8′);
mysql_query(”SET SESSION collation_connection =’utf8_general_ci’”);
Its very easy Just Copy those code paste and run. Ooo the most importnt thing, you need a unicode for insert & retrive. i use avro unicode. So you must download avro unicode.
this tutorial is referenced by saidur vai.
It would be nice if you could upload files from a form. Here a complete example how to upload a file in php.
Now start the work…..
1st you have to create a HTML form for uploading file.
The HTML form is following:
<html>
<body>
<table border=”1″ align=”center”>
<tr><td>
<form action=”upload_file.php” method=”post”
enctype=”multipart/form-data”>
<label for=”file”>Filename:</label>
<input type=”file” name=”file” id=”file” />
<input type=”submit” name=”submit” value=”Upload” />
</tr></td>
</form>
</body>
</html>
Then save it as file_upload.html.
Now create the file uploading script,
<?php
if ($_FILES["file"]["error"] > 0)
{
echo “Error: ” . $_FILES["file"]["error"] . “<br />”;
}
else
{
echo “Upload: ” . $_FILES["file"]["name"] . “<br />”;
echo “Type: ” . $_FILES["file"]["type"] . “<br />”;
echo “Size: ” . ($_FILES["file"]["size"] / 1024) . ” Kb<br />”;
echo “Stored in: ” . $_FILES["file"]["tmp_name"];
}
?>
save this as file_upload.php. Run this program.
By using the global PHP $_FILES array you can upload files from a client computer to the remote server.
This the very simple way to uploading file.
<?php
$host = ‘localhost’;
$user_name = ‘root’;
$user_password = ”;
$default_db_name = ‘mysql’;
if(!mysql_connect($host,root)) die (“connection failed”);
if(!mysql_select_db ($default_db_name)) die (“can’t select database”);
echo “succesfully connect database”;
?>
This process can connect to mysql databases very easily. For this code not need worry about password. Don’t give any password in ur mysql configure. Save it as phpconnect.php













Recent Comments