Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Page 2 of 2 FirstFirst 1 2
Results 11 to 13 of 13
  1. #11
    Senior Member Webzarus's Avatar
    Join Date
    May 2011
    Location
    South Carolina Coast
    Posts
    3,322
    Member #
    27709
    Liked
    770 times
    Quote Originally Posted by zabrielza View Post
    Actually, i just have started learning SQL in the w3schools. I have to say that i am very interested in it. For now this is fairly easy. Of course in next chapters the difficulty will be a bit more.

    A question is, after learning SQL and all this, If i want to have english and other languages do i have to have several databases for each language?
    o
    actually this is a logical question, and yes, it's actually easier running a multi-lingual site by using a DB TABLE to hold the content in the different languages , I personally use the "language" identifier of a browser to set the "default language" the visitor see's, then if I have multiple languages you can offer links to the user to change the language.

    Once you have defined the table for the content in your original language, then you can copy that table, rename it... change the content to the appropriate language, etc.... no, there is no tool I'm aware of that will convert the actual content from one language to another.

    normally, if a client wants a multiple language site, I have them provide the content in the different languages. They normally have the resources and native speakers to provide exact translation of the content.

  2.  

  3. #12
    Junior Member
    Join Date
    Jul 2013
    Posts
    12
    Member #
    36733
    Hello again,

    I am here again with some code this time. I created a file named insert.php

    Code:
    <?php
        
        //This insert.php is used to insert data into a table
        
        $con = mysqli_connect ( "localhost", "root", "xxxxxx", "my_db") ;
        //Firstly let us check connection
        if (mysqli_connect_errno ())
            {
                echo "Failed to connect to MySQL: " . mysqli_connect_error () ;
            }
        
        //Now, let us insert data into table Projects_School
        $sql = "INSERT INTO Projects_School ( Title, Description, Year, Project_Team)"
        VALUES
        ( '$_POST[Title]', '$_POST[Description]', '$_POST[Year]', '$_POST[Team]') ;
        
        //Finally, let us check the insertion
        if ( !mysqli_query ( $con, $sql))
            {
                die ( 'Error: ' . mysqli_error ( $con)) ;
            }
        echo "1 record added" ;
        
        mysqli_close ( $con) ;
    ?>
    which file will be called from HTML with this code

    Code:
    <form action = "insert.php" method = "post">
            Title: < input type= "text" name= "Title">
            Description < input type = "text" name = "Description">
            Year < input type= "text" name= "Year">
            Team < input type= "text" name= "Team">
            <input type="submit">
        </form>
    and of course i have created a db and a table named Projects_School

    Code:
    <?php
    //create connection
    $con = mysqli_connect("http://localhost", "root", "xxxxxx", "my_db" ) ;
    
    //check connection
    if (mysqli_connect_errno ( $con))
        {
            echo "Failed to connect to MySQL: " . mysqli_connect_error() ;
        }
    
    //create database
    $cr_db = "CREATE DATABASE my_db" ;
    if (mysqli_query ( $con, $cr_db))
        {
            echo "Database my_db succesfully created!";
        }
    else
        {
            echo "Error creating database:" . mysqli_error ( $con) ;
        }
    
    //create table projects_school!
    $cr_tb = "CREATE TABLE Projects_School ( PID INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(PID), Title CHAR(30), Description TEXT, Year INT, Team CHAR(255)" ;
    
    //execute query
    if ( mysqli_query ( $con, $cr_tb))
        {
            echo "Table Projects_School succesfully created!" ;
        }
    else
        {
            echo "Error creating table:" . mysqli_error ( $con) ;
        }
    
    
    ?>
    My first question is What is your opinion? My second question is if the TEXT INT CHAR are right for what i need. My third question is, If someone open up firefox and hit page source in my php connection to mysql i write my password and all the credentials. What security can i have for my website as i do not know much about websites? More research right? But on what?

    FInally, i created an Html page but is not very ready and readable for now. In this home.html i have put a php code which selects all the data stored in the table after inerting it with insert.php and converts to arrays to start the random thing.

    Code:
    <?php
            $con = mysqli_connect ( "localhost", "root", "3t0GB620", "my_db");
            //Let us check connection!
            if ( mysqli_connect_errno ())
                {
                echo "Failed to connect to MySQL: " . mysqli_connect_error () ;
                }
            
            //Let us store all the data in the $result variable!
            $result = mysqli_query ( $con, "SELECT * Projects_School") ;
            
            while ( $row = mysqli_fetch_array ( $result))
                {
                    i = 0;
                    multi_array = row[i];
                    i = i + 1;
                }
            mysqli_close ( $con) ;
        ?>
    What do you think of it?

    Thank you very much!

  4. #13
    Junior Member
    Join Date
    Jul 2013
    Posts
    12
    Member #
    36733
    Quote Originally Posted by Webzarus View Post
    o
    actually this is a logical question, and yes, it's actually easier running a multi-lingual site by using a DB TABLE to hold the content in the different languages , I personally use the "language" identifier of a browser to set the "default language" the visitor see's, then if I have multiple languages you can offer links to the user to change the language.

    Once you have defined the table for the content in your original language, then you can copy that table, rename it... change the content to the appropriate language, etc.... no, there is no tool I'm aware of that will convert the actual content from one language to another.

    normally, if a client wants a multiple language site, I have them provide the content in the different languages. They normally have the resources and native speakers to provide exact translation of the content.
    Well, i to defined a database from phpmyadmin and then tried to define a table in my language but the encoding is not right. If i set it to english then i will have wrong encoding there. What should i do? Can i run multiple times phpmyadmin with different settings in each?


Page 2 of 2 FirstFirst 1 2

Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 06:16 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com