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

Thread: PhP help

  1. #1
    Join Date
    Jul 2007
    Location
    South Wales
    Posts
    1,386
    Tokens
    0

    Latest Awards:

    Default PhP help

    what goes in these?
    Code:
    <?
    $host = "localhost";
    $dbuser = "Database User";
    $dbpwd = "Database Password";
    $db = "Database Name";
    $connect = mysql_pconnect($host, $dbuser, $dbpwd);
    if(!$connect)
    echo("Could not connect to database...");
    else
    $select = mysql_select_db($db);
    ?>
    Moved by Hitman (Forum Moderator) from Designing & Development: Please post in the correct forum next time, thanks.
    Last edited by Hitman; 27-03-2008 at 08:17 PM.
    Im a runescape player.



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

    Latest Awards:

    Default

    You need to setup a database, go to your hosts, MyPhpAdmin page and then create a new database with the name Database, then create a user with the name User and password of (what ever you want). And give the user full access rights to the databse.

    Then your php should be.

    PHP Code:
    <?
    $host 
    "localhost";
    $dbuser "User";
    $dbpwd "[I]YourPassword!![/I]";
    $db "Database";
    $connect mysql_pconnect($host$dbuser$dbpwd);
    if(!
    $connect)
    echo(
    "Could not connect to database...");
    else
    $select mysql_select_db($db);
    ?>
    Lets set the stage on fire, and hollywood will be jealous.

  3. #3
    Join Date
    Jun 2006
    Posts
    4,832
    Tokens
    0

    Latest Awards:

    Default

    Also, shouldn't the if statement be like this:

    PHP Code:
    <?
    $host 
    "localhost";
    $dbuser "Database User";
    $dbpwd "Database Password";
    $db "Database Name";
    $connect mysql_pconnect($host$dbuser$dbpwd);
    if(!
    $connect) {
    echo(
    "Could not connect to database...");
    } else {
    $select mysql_select_db($db);
    }
    ?>

  4. #4
    Join Date
    Jul 2007
    Location
    South Wales
    Posts
    1,386
    Tokens
    0

    Latest Awards:

    Default

    it says Parse error: syntax error, unexpected '=' in /home/icehabbo/public_html/config.php on line 2
    Code:
    <?
    $host&nbsp;=&nbsp;"localhost";
    $dbuser&nbsp;=&nbsp;"icehabbo_david";
    $dbpwd&nbsp;=&nbsp;"for security reasons";
    $db&nbsp;=&nbsp;"icehabbo_user";
    $connect&nbsp;=&nbsp;mysql_pconnect($host,&nbsp;$dbuser,&nbsp;$dbpwd);
    if(!$connect)
    echo("Could&nbsp;not&nbsp;connect&nbsp;to&nbsp;database...");
    else
    $select&nbsp;=&nbsp;mysql_select_db($db);
    ?>
    Last edited by Rafiki; 27-03-2008 at 08:22 PM.
    Im a runescape player.



  5. #5
    Join Date
    Jun 2006
    Posts
    4,832
    Tokens
    0

    Latest Awards:

    Default

    Can you post the code you tried please?

  6. #6
    Join Date
    Apr 2005
    Posts
    4,614
    Tokens
    1,290

    Latest Awards:

    Default

    Are you using Hitmans code?

  7. #7
    Join Date
    Jul 2007
    Location
    South Wales
    Posts
    1,386
    Tokens
    0

    Latest Awards:

    Default

    Code:
    <?
    $host&nbsp;=&nbsp;"localhost";
    $dbuser&nbsp;=&nbsp;"icehabbo_david";
    $dbpwd&nbsp;=&nbsp;"*removed*";
    $db&nbsp;=&nbsp;"icehabbo_user";
    $connect&nbsp;=&nbsp;mysql_pconnect($host,&nbsp;$dbuser,&nbsp;$dbpwd);
    if(!$connect)
    echo("Could&nbsp;not&nbsp;connect&nbsp;to&nbsp;database...");
    else
    $select&nbsp;=&nbsp;mysql_select_db($db);
    ?>
    there is code :S
    Im a runescape player.



  8. #8
    Join Date
    Jun 2006
    Posts
    4,832
    Tokens
    0

    Latest Awards:

    Default

    Quote Originally Posted by Rafiki View Post
    Code:
    <?
    $host&nbsp;=&nbsp;"localhost";
    $dbuser&nbsp;=&nbsp;"icehabbo_david";
    $dbpwd&nbsp;=&nbsp;"*removed*";
    $db&nbsp;=&nbsp;"icehabbo_user";
    $connect&nbsp;=&nbsp;mysql_pconnect($host,&nbsp;$dbuser,&nbsp;$dbpwd);
    if(!$connect)
    echo("Could&nbsp;not&nbsp;connect&nbsp;to&nbsp;database...");
    else
    $select&nbsp;=&nbsp;mysql_select_db($db);
    ?>
    there is code :S
    I removed the password for you, don't want anybody getting into your cP.

    Try the code I gave.

  9. #9
    Join Date
    Jul 2007
    Location
    South Wales
    Posts
    1,386
    Tokens
    0

    Latest Awards:

    Default

    http://icehabbo.com/ thts what it says now :S
    Im a runescape player.



  10. #10
    Join Date
    Apr 2005
    Posts
    4,614
    Tokens
    1,290

    Latest Awards:

    Default

    Why have you got loads of spaces (&nbsp? :S

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
  •