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!


Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: mysql help

  1. #1
    Join Date
    Feb 2006
    Location
    Ontario Canada
    Posts
    4,587
    Tokens
    0

    Latest Awards:

    Default mysql help

    can anyone give me a code to add a table to mysql database via php file.. my phpmyadmin won't open but mysql is still online..

    .:.:#14:.:. .:.: Impossible Is Nothing :.:. .:.: 845 Rep:.:.
    .:.: Stand up for what is right, even if you stand alone:.:.


  2. #2
    Join Date
    May 2008
    Posts
    605
    Tokens
    0

  3. #3
    Join Date
    Feb 2006
    Location
    Ontario Canada
    Posts
    4,587
    Tokens
    0

    Latest Awards:

    Default

    i got this
    PHP Code:
    <?php
    // Make a MySQL Connection
    mysql_connect("""""") or die(mysql_error());
    mysql_select_db("") or die(mysql_error());

    // Create a MySQL table in the selected database
    mysql_query("CREATE TABLE `messages` (
      `id` int(11) NOT NULL auto_increment,
      `reciever` varchar(25) NOT NULL default '',
      `sender` varchar(25) NOT NULL default '',
      `subject` text NOT NULL,
      `message` longtext NOT NULL,
      `recieved` enum('0','1') NOT NULL default '0',
      PRIMARY KEY  (`id`)"
    )
     or die(
    mysql_error());  

    echo 
    "Table Created!";

    ?>
    but it gives this error:
    You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 8

    .:.:#14:.:. .:.: Impossible Is Nothing :.:. .:.: 845 Rep:.:.
    .:.: Stand up for what is right, even if you stand alone:.:.


  4. #4
    Join Date
    May 2008
    Posts
    605
    Tokens
    0

  5. #5
    Join Date
    Feb 2006
    Location
    Ontario Canada
    Posts
    4,587
    Tokens
    0

    Latest Awards:

    Default

    still same error.

    .:.:#14:.:. .:.: Impossible Is Nothing :.:. .:.: 845 Rep:.:.
    .:.: Stand up for what is right, even if you stand alone:.:.


  6. #6
    Join Date
    May 2007
    Posts
    467
    Tokens
    0

    Default

    Try this:

    PHP Code:
    <?php
    // Make a MySQL Connection
    mysql_connect("""""") or die(mysql_error());
    mysql_select_db("") or die(mysql_error());

    // Create a MySQL table in the selected database
    mysql_query("CREATE TABLE messages (
      id int unsigned NOT NULL auto_increment,
      reciever varchar(25) NOT NULL default '',
      sender varchar(25) NOT NULL default '',
      subject text NOT NULL,
      message longtext NOT NULL,
      recieved enum('0','1') NOT NULL default '0',
      PRIMARY KEY (id)
    ) TYPE=MyISAM;"
    )or die(mysql_error()); 

    echo 
    "Table Created!";

    ?>
    can not say it will work but give it a go.

  7. #7
    Join Date
    Feb 2006
    Location
    Ontario Canada
    Posts
    4,587
    Tokens
    0

    Latest Awards:

    Default

    rep. it worked.

    .:.:#14:.:. .:.: Impossible Is Nothing :.:. .:.: 845 Rep:.:.
    .:.: Stand up for what is right, even if you stand alone:.:.


  8. #8
    Join Date
    May 2007
    Posts
    467
    Tokens
    0

    Default

    Cool its good that thats works i have not made mysql tables for about 5 weeks

  9. #9
    Join Date
    Feb 2006
    Location
    Ontario Canada
    Posts
    4,587
    Tokens
    0

    Latest Awards:

    Default

    nvm fixed it. missed a session start..
    how i get rid of all these errors:
    Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent

    also..
    I'm using a php navigation
    that does ?page=viewmsg
    So how do i get viewmsg.php?msg_id=5
    to work with that.
    Last edited by Colin-Roberts; 13-08-2008 at 12:37 PM.

    .:.:#14:.:. .:.: Impossible Is Nothing :.:. .:.: 845 Rep:.:.
    .:.: Stand up for what is right, even if you stand alone:.:.


  10. #10
    Join Date
    Dec 2006
    Posts
    3,970
    Tokens
    0

    Latest Awards:

    Default

    Quote Originally Posted by Colin-Roberts View Post
    nvm fixed it. missed a session start..
    how i get rid of all these errors:
    Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent

    also..
    I'm using a php navigation
    that does ?page=viewmsg
    So how do i get viewmsg.php?msg_id=5
    to work with that.
    For the session_start() error, make sure session_start() is right at the top of your code.
    Lets set the stage on fire, and hollywood will be jealous.

Page 1 of 2 12 LastLast

Posting Permissions

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