Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Jul 2009
    Posts
    21
    Thanks
    5
    Thanked 0 Times in 0 Posts

    MySQL Info With Include PHP

    Hello,

    My problem is that i cant connect with MySQL.

    I get This Error
    Code:
    Warning: mysql_connect() [function.mysql-connect]: Can't connect to MySQL server on '217.18.70.82' (4) in /home/assassin/domains/realdutchserver.nl/public_html/webformysql/bans.php on line 23
    Could not connect to database
    This is My Code

    Code:
    $db = mysql_connect('$host','$username','$password') or die(mysql_error()); // This connects to the MySQL server
    mysql_select_db('$database', $db);
    This is the Include i Use
    Code:
    <?php
    $host = '217.18.70.82';
    $username = 'server5646';
    $password = 'password';
    $database = 'server5646';
    ?>

  • #2
    UE Antagonizer Fumigator's Avatar
    Join Date
    Dec 2005
    Location
    Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
    Posts
    7,691
    Thanks
    42
    Thanked 637 Times in 625 Posts
    Your database or user is not configured correctly.

  • #3
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    Your code is wrong. You are using single quotes around your variables. If you want treated as variables then use double quotes or no quotes at all.
    PHP Code:
    $db mysql_connect($host,$username,$password) or die(mysql_error()); // This connects to the MySQL server
    mysql_select_db($database$db); 
    ||||If you are getting paid to do a job, don't ask for help on it!||||


  •  

    Posting Permissions

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