Discover Habbo's history
Treat yourself with a Secret Santa gift.... of a random Wiki page for you to start exploring Habbo's history!
Happy holidays!
Celebrate with us at Habbox on the hotel, on our Forum and right here!
Join Habbox!
One of us! One of us! Click here to see the roles you could take as part of the Habbox community!


Results 1 to 6 of 6
  1. #1
    Join Date
    Jul 2005
    Location
    Belgium
    Posts
    2,492
    Tokens
    147

    Latest Awards:

    Default mySQL problem(s) <--> help please

    ok so i cant access my databases in cpanel (host problems)

    i can add new databases; but it doesnt show them on myphpadmin
    So i have to edit etc via .php files.

    How can i add a table in my database with php ?

    i know how to insert into a table but i dont know how to create table with php


    +rep for helpers

    Thanks in advance.

  2. #2
    Join Date
    Mar 2006
    Location
    Scotland
    Posts
    1,012
    Tokens
    175

    Latest Awards:

    Default

    Tut, Tut, Tut.

    Oli it should be in Coding!

    Anyway that should help.


    You don't like me
    Chances are I don't like you.

  3. #3
    Join Date
    Jul 2005
    Location
    Belgium
    Posts
    2,492
    Tokens
    147

    Latest Awards:

    Default

    Quote Originally Posted by RichardKnox View Post
    Tut, Tut, Tut.

    Oli it should be in Coding!

    Anyway that should help.
    Ah yeah, sorry, always forget there's a coding section

  4. #4
    Join Date
    Aug 2005
    Posts
    856
    Tokens
    0

    Default

    Create a file... with extension .php and do the following

    PHP Code:
    <?
    include("config.php"); //Includes the file to connect to the database
    $table mysql_query("CREATE TABLE `tablename` ( 
    `id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
    `ROWNAME` VARCHAR(LENGTH) NOT NULL, 
    `ROWNAME` VARCHAR(LENGTH) NOT NULL, 
    `ROWNAME` VARCHAR(LENGTH) NOT NULL, 
    `ROWNAME` VARCHAR(LENGTH) NOT NULL 
    ) ENGINE = myisam;"
    ) or die ('Error during the execution of the MySQL query : ' mysql_error());  //Creates the table or echos an error
    echo("Done. Please delete this file... or remove it from the server");
    ?>
    Replace `tablename` with the name of the table make sure you have `` wrapped around it.

    Replace ROWNAME with the name of the row, again make sure you have ``

    Replace LENGTH with the max input of the field.

    If you want to make more than one table, simple edit the file with the details, and run it again.

    Should all work
    Last edited by xRoyal15; 12-11-2006 at 11:52 AM.

  5. #5
    Join Date
    Jul 2005
    Location
    Belgium
    Posts
    2,492
    Tokens
    147

    Latest Awards:

    Default

    Ah sorry didnt see your post.

    I've already fixed it
    But i will +rep you for your effort.

    Thanks


    Problem solved, thread can be closed or removed

  6. #6
    Join Date
    Aug 2005
    Posts
    856
    Tokens
    0

    Default

    Oki, Thanks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •