i need an simple example of multi languages

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
egturnkey
Forum Commoner
Posts: 34
Joined: Sun Jul 26, 2009 7:35 pm

i need an simple example of multi languages

Post by egturnkey »

Hello Friends,

i need an simple example explain to me how this could be.

- a database table has 2 lang ( english - french ) where english is the dafult

- an php file that has input where it can shown the text with abilities to update it

explain more
------------

1- database where i can store the english language and french language.

2- config.php // connect to the database.

3- index.php file that shown the varibles language in english which select form where i can switch off btween english/french. and it shown it in a input with abilites to update the text language

:oops: can anyone help me even with a very very primtive example cause i really needs to understand it and example is the only way that helps me to understood the whole idea.


thanks in advance
User avatar
Jade
Forum Regular
Posts: 908
Joined: Sun Dec 29, 2002 5:40 pm
Location: VA

Re: i need an simple example of multi languages

Post by Jade »

I'm not totally sure what you're asking for but I'll give it a go.

On the index page you'll need to create a drop down box where they can select a language. Depending on the language they select set a session variable for that language.

Every time you load a page you'll need to check the value of that session variable. Then select the appropriate text where language=$_SESSION['language'];

Here's some other stuff you'll want to read:

Setting up a mySQL Database: http://dev.mysql.com/doc/refman/5.1/en/ ... e-use.html
Connecting to a database: http://www.php.net/function.mysql-connect
Sessions: http://www.php.net/manual/en/book.session.php
SQL Select Query: http://dev.mysql.com/doc/refman/5.0/en/select.html
Post Reply