Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Multi-languages website ( inside 2 tables of database )
Old 05-10-2009, 06:24 AM Multi-languages website ( inside 2 tables of database )
Novice Talker

Posts: 10
Trades: 0
Hello Friends,

Here is the last question i may ask, cause my php script is going to released so soon and it is free script, with sharing of many question i've asked here so i really love you all guys.

Today problem is as following

Multi-languages website

We have the following file

index.php
and it has some words and input textarea

config.php
connection for database

lang_ar.php and lang_en.php
both for languages

database of 2 tables
english
arabic


But for the input text in database tables



wt will be the code/function

when it goes english ---> the text area input goes to english table

and

when it goes arabic --> the text area input goes to arabic tables



also at the index.php


wt will be the code/function

when it goes english ---> it call the input text at english table

and

when it goes arabic --> it call the input text at arabic tables


in simple way
Quote:
if lang = english
input texts goes to english table

if lang = arabic
input texts goes to arabic table


when lang = english
it shown the texts at the english table

when lang = arabic
it shown the texts at the arabic table
hope you understood what i meant ,if there an example it will be very helpfull

thanks so so much
egturnkey is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 05-11-2009, 10:13 AM Re: Multi-languages website ( inside 2 tables of database )
nayes84's Avatar
Extreme Talker

Latest Blog Post:
Difference between ASP And JSP
Posts: 232
Name: John
Location: Tokyo
Trades: 0
why don't you just use one table for the two languages and just add a new column to identify the language. that will make it easier for you if you needed to add more languages in the future or when you need to modify the structure of the table.

anyway here is a sample code to do what you need
PHP Code:
if($lang == "english")
   
$table_name="english_data";

else if(
$lang == "arabic")
   
$table_name="arabic_data";

mysql_query("insert into $table_name (id,name,etc...) values (...)"); 
PHP Code:
if($lang == "english")
   
$table_name="english_data";
 
 else if(
$lang == "arabic")
   
$table_name="arabic_data";

mysql_query("select * from $table_name where id=..."); 
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE

if(I'm("Helpful")) Add_Talkupation("nayes84");
nayes84 is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Multi-languages website ( inside 2 tables of database )
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.18244 seconds with 12 queries