Results 1 to 6 of 6

Thread: MYSQL Server Connection Error

  1. #1
    stormprograms is offline x10Hosting Member
    Join Date
    Sep 2009
    Posts
    5

    MYSQL Server Connection Error

    Okay so I have been trying to get my config.php to act as my establish for my MYSQL but I can't get the MYSQL Connect to work. When I run my code through codepad.org I get this error:
    Code:
    Fatal error: Call to undefined function mysql_connect() on line 7
    Now the code for my config.php is:

    Code:
    <?php
    //Mysql connection
    	DEFINE ('DB_USER', '***********'); // Insert your database username into the quotes.
    	DEFINE ('DB_PASSWORD', '*********'); // Insert your database password into the quotes.
    	DEFINE ('DB_HOST', '******************'); // This will most likely stay the same.
    	DEFINE ('DB_NAME', '************');// Insert your actual database name in the quotes.
    	$dbc = mysql_connect (DB_HOST, DB_USER, DB_PASSWORD) OR die ('Could not connect to MySQL: ' . mysql_error());
    	mysql_select_db (**************) OR die('Could not select the database: ' . mysql_error() );
    //script basic variables
    	$timeout = 5;
    ?>
    Still I cant figure out what's wrong

    The error code when you try to access it through a url is:

    Code:
    Warning:  mysql_connect() [function.mysql-connect]: Can't connect to MySQL server on 'mysql11.000webhost.com' (4) in /home/palace/runeleague/storm/config.php on line 7
    Could not connect to MySQL: Can't connect to MySQL server on 'mysql11.000webhost.com' (4)

  2. #2
    xadrieth is offline x10Hosting Member
    Join Date
    Apr 2009
    Posts
    62

    Re: MYSQL Server Connection Error

    I'm not sure, but judging from the error, the "mysql_connect()" function might now be disabled.

    use "mysqli_connect".

    syntax is like this:
    PHP Code:
    $dbc mysqli_connect('localhost''root''pw''data'); 

  3. #3
    diabolo's Avatar
    diabolo is offline Community Advocate
    Join Date
    Nov 2007
    Location
    Jersey Shore
    Posts
    1,681

    Re: MYSQL Server Connection Error

    Code:
    MySQL server on 'mysql11.000webhost.com'
    that's your error

    the server for x10 is:
    localhost
    or
    mysql.x10hosting.com

    PHP Code:
    <?php
    //Mysql connection
        
    DEFINE ('DB_USER''***********'); // Insert your database username into the quotes.
        
    DEFINE ('DB_PASSWORD''*********'); // Insert your database password into the quotes.
        
    DEFINE ('DB_HOST''localhost'); // This will most likely stay the same.
        
    DEFINE ('DB_NAME''************');// Insert your actual database name in the quotes.
        
    $dbc mysql_connect (DB_HOSTDB_USERDB_PASSWORD) OR die ('Could not connect to MySQL: ' mysql_error());
        
    mysql_select_db (**************) OR die('Could not select the database: ' mysql_error() );
    //script basic variables
        
    $timeout 5;
    ?>
    and just fill out the rest



  4. #4
    garrettroyce's Avatar
    garrettroyce is offline Generally Helpful Member
    Join Date
    Apr 2008
    Location
    IL, USA
    Posts
    3,880

    Re: MYSQL Server Connection Error

    Quick pointer. Do NOT define() passwords! They will be available everywhere in the script and present a large security risk.

    Also, why are you connecting to another hosts mysql?
    Garrett Royce | Generally Helpful Member
    `ord(103)`@gjr.gr
    █ I promise not to try not to mess with your mind
    Tech Support | Programming Help | Flow Chart Tutorial

  5. #5
    stormprograms is offline x10Hosting Member
    Join Date
    Sep 2009
    Posts
    5

    Re: MYSQL Server Connection Error

    Currently x10hosting seems to block port 43594 but I just need some assistance still. I will use a x10hosting MYSQL for now but how can I resolve this?

  6. #6
    xav0989's Avatar
    xav0989 is offline Community Public Relation
    Join Date
    Jul 2008
    Location
    ifk
    Posts
    4,468

    Re: MYSQL Server Connection Error

    Remote MySQL is currently disabled on x10 free accounts. You have three major choices:
    • Move everything to x10Hoting;
    • Code or modify an xmlrpc interface so that the queries are executed on the server where your DB resides, and the remote script returns a xml or JSON data feed. Use a tool such as MySQL-PHP Suite (MySQL-PHP Client & MySQL-PHP Server) to remotely execute your queries and get the results locally (connection unencrypted though);
    • Buy a premium package.
    Xavier L | Community Public Relations Manager (Free Hosting Support)
    █ Yes, my position is too cool to even exist!
    How am I helping? Rate this post by clicking the icon below! (this is even better than "liking" a post)
    Terms of Service | Acceptable Use Policy | x10Hosting Wiki

Similar Threads

  1. Server: 500 internal server error
    By xwebhost in forum Free Hosting
    Replies: 1
    Last Post: 11-30-2008, 05:42 AM
  2. X10hosting - Web server software ERROR
    By beisan-net in forum Scripts, 3rd Party Apps, and Programming
    Replies: 1
    Last Post: 06-01-2008, 07:57 PM
  3. 500 internal server error
    By beisan-net in forum Free Hosting
    Replies: 3
    Last Post: 04-30-2008, 02:47 PM
  4. Internal Server Error (But nothing is on the site!)
    By zograf in forum Free Hosting
    Replies: 3
    Last Post: 04-11-2008, 01:36 PM
  5. Replies: 3
    Last Post: 01-26-2006, 05:01 PM

Posting Permissions

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