Jump to content
Welcome, Guest
Existing user? Sign In

Sign In



Sign Up
The MatriX
  • Welcome To Ghbsys
  • CS GO Streaming Version is released. Have fun streaming while cheating!
  • Have a Payment Issue? Send us a Support ticket.
  • Make a thread if you need support or join our discord for live support.
  • Have Suggestions? Make a thread and you'll earn Ghbsys Points for implemented suggestions.
  • Join our discord to stay well connected! Don't forget to integrate your discord to the site
  • Welcome to [GHB] - GAmEhAcKbAsTaRdS Forum

    Welcome to [GHB] - GAmEhAcKbAsTaRdS Forum, like most online communities you must register to view or post in our community, but don't worry this is a simple free process that requires minimal information for you to signup. Be apart of [GHB] - GAmEhAcKbAsTaRdS Forum by signing in or creating an account.
    • Start new topics and reply to others
    • Subscribe to topics and forums to get email updates
    • Get your own profile page and make new friends
    • Send personal messages to other members.

    Another PHP tutorial (MySQL introduction)


    House
     Share

    Recommended Posts

    Hi folks!

     

    Now I am going to show you some SQL!

     

    SQL Stands for:

    Structured Query Language.

     

    Querying means: Sending a request to the server.

    Structured means: Structured requests, and informations being saved and handled in Tables with columns and rows.

     

    Here I am going to show you just a little simple tutorial from how to add something to a database and retrieving it later.

     

    Step 1:

    Create a host at for example: www.ghbsys.net

    If you already HAVE a host, skip this step.

     

    If you created the host, activate FTP and SQL. Choose a good password, then view the accountdata of your FTP account and SQL account.

     

    Then, create a database and a table.

    Remember the names of them! Best: write them down or create a little .txt on your desktop.

     

    Table:

    2 rows.

    Both VARCHAR

    and maximum of characters in it: 100.

    So you have a lot of room xD

     

    Step 2:

     

    Create a file, called "register.php"

     

    Body of the file:

    <html>
    <head>
    <title>Register.php</title>
    </head>
    <body>
    <form action="register.php" method="post">
    Input1 (Username or email for example :-))
    <input type="text" name="username" />
    Input2 (Password)
    <input type="password" name="password" />
    <input type="submit" name="submit" value="Register!" />
    </form>
    <?php
    if(isset($_POST['submit']))
    {
    //First we declare all global variables :-)
    $username = $_POST['username'];
    $password = $_POST['password'];
    //These were the variables.
    
    //Now we connect to the database in MySQL. In your case enter for localhost: yoursite.ghbsys.net, 
    //for root: your username and for password your pass.
    mysql_connect("localhost","root","password");
    //now we are connected :-)
    
    mysql_select_db("Your_Database");
    //now we have selected Your_Database (off course, insert your own database in here!!!)
    
    $query = "INSERT into ´your_table1´ VALUES ´username´,´password´";
    $query2 = mysql_query($query);
    if(!$query2) echo "Error!".mysql_error();
    else
    {
    echo "Your information has been successfully added to the database."
    }
    //Now, (pretty obvious...) your info has been added to the database.
    //Always be careful that the rows in your MySQL-table match the rows you insert.
    //Otherwise, you will get errors, like column_count doesn't match at ...
    
    }
    }
    ?>
    
    </body>
    </html>

     

    This is a very simple script.

     

    In the next tutorial I will show you, how to VIEW the content of your MySQL-table!!!

     

    HAVE FUN!

     

    oh almost forgot:

     

    Don't forget to ask me when there are questions:

    ICQ: 306-354-502

    MSN: [email protected]

    Skype: Fabinator4444

    Edited by Joachim Pfuetz
    Link to comment
    Share on other sites

    Guest
    This topic is now closed to further replies.
     Share

    • Recently Browsing   0 members

      • No registered users viewing this page.
    ×
    ×
    • Create New...