+ Reply to Thread
Page 1 of 2 12 LastLast
Results 1 to 10 of 13

Thread: PHP MYSQL Connect

  1. #1
    LunarSage is offline x10Hosting Member LunarSage is an unknown quantity at this point
    Join Date
    Jan 2009
    Posts
    4

    PHP MYSQL Connect

    Hello everyone, I have a unusual problem... I have my own MYSQL server but I cannot in any way get php scripts to connect to it. This has been going on for over a month now and x10 support has not helped. Here is one of the scripts im using to connect to it....
    <?php

    $options = array (
    'DBHost' => 'xx.xx.xx.xx:port',
    'DBUser' => 'xxxxx',
    'DBPass' => 'xxxxx',
    'DBName' => 'xxxxx',
    'ServerName' => 'xxxxx',
    'ServerURL' => 'xxxxx'
    );

    class sql {
    function sql() {
    global $options;

    $this->connection = @mysql_connect($options['DBHost'],$options['DBUser'],$options['DBPass'])
    OR die('MySQL Connection Error...');
    mysql_select_db($options['DBName'])
    OR die('Database selection Error...');
    }

    Any suggestions or help is greatly appreciated.

  2. #2
    garrettroyce's Avatar
    garrettroyce is offline Generally Helpful Member garrettroyce is a glorious beacon of lightgarrettroyce is a glorious beacon of light
    Join Date
    Apr 2008
    Location
    IL, USA
    Posts
    3,746

    Re: PHP MYSQL Connect

    Do you have port forwarding set for your home network?
    gjr.gr - coming soon: secrets of OCD coding from a self taught tinkerer

  3. #3
    LunarSage is offline x10Hosting Member LunarSage is an unknown quantity at this point
    Join Date
    Jan 2009
    Posts
    4

    Re: PHP MYSQL Connect

    Yea im absolutely sure that my ports are forwarded, I also thought about moving my database to x10 so I could just put localhost and it would work... but still something like that I shouldn't be having this trouble...

  4. #4
    sarvar's Avatar
    sarvar is offline x10Hosting Member sarvar is an unknown quantity at this point
    Join Date
    Sep 2007
    Posts
    82

    Re: PHP MYSQL Connect

    PHP Code:
    class sql {
    function 
    sql() {
    global 
    $options;

    $this->connection = @mysql_connect($options['DBHost'],$options['DBUser'],$options['DBPass'])
    OR die(
    'MySQL Connection Error...');
    mysql_select_db($options['DBName'])
    OR die(
    'Database selection Error...');
    }} 
    I think you forgot the last ending bracket.
    Last edited by sarvar; 02-27-2009 at 03:02 PM.
    CLICK HERE to Thank Me.
    (You must be logged in into forums.)

  5. #5
    Livewire's Avatar
    Livewire is offline Abuse Compliance Officer Livewire is a glorious beacon of lightLivewire is a glorious beacon of light
    Join Date
    Jun 2005
    Location
    Behind a keyboard.
    Posts
    8,998

    Re: PHP MYSQL Connect

    More likely I'd think x10's firewall is preventing any outgoing connections altogether; you may want to file a support ticket at http://support.x10hosting.com to see if there's a way to "whitelist" your ip/port so you can use your own sql database instead of one at x10.


    Conversely moving it to x10'll solve the issue as well because localhost isn't blocked by the firewall


    TOS breakers will be suspended regardless of race, creed, national origin, hair color, or favorite food. Thanks for your understanding!

  6. #6
    LunarSage is offline x10Hosting Member LunarSage is an unknown quantity at this point
    Join Date
    Jan 2009
    Posts
    4

    Re: PHP MYSQL Connect

    @sarvar
    Yea your right I did miss that. Thanks

    @Livewire
    Yea I submitted a support ticket over a month ago and nothing has been done and this script is very vital to my site...I guess I just have to sit and wait longer since there is nothing I can do =/
    Last edited by LunarSage; 02-27-2009 at 03:59 PM.

  7. #7
    xav0989's Avatar
    xav0989 is offline Community Public Relation xav0989 is just really nice
    Join Date
    Jul 2008
    Location
    ifk
    Posts
    4,438

    Re: PHP MYSQL Connect

    You could create a xmlrpc server on your database server to fetch data...
    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

  8. #8
    leafypiggy's Avatar
    leafypiggy is offline Community Advocate leafypiggy is on a distinguished road
    Join Date
    Aug 2007
    Location
    Massachusetts
    Posts
    2,228

    Re: PHP MYSQL Connect

    The firewall on the server prevents connections other than localhost from connecting to the mySQL database. You may want to just import your database into the x10hosting database.
    Neil Hanlon | x10Hosting Support Representative
    Neil[at]x10hosting.com
    █ I'm always happy to help. Just ask a question in Free Hosting
    Terms of Service IRC

  9. #9
    dvanillailla is offline x10Hosting Member dvanillailla is an unknown quantity at this point
    Join Date
    Mar 2009
    Posts
    9

    Re: PHP MYSQL Connect

    Quote Originally Posted by leafypiggy View Post
    The firewall on the server prevents connections other than localhost from connecting to the mySQL database. You may want to just import your database into the x10hosting database.
    x10 won't let you import. They like inconveniencing people who don't start fresh with them.

  10. #10
    sarvar's Avatar
    sarvar is offline x10Hosting Member sarvar is an unknown quantity at this point
    Join Date
    Sep 2007
    Posts
    82

    Re: PHP MYSQL Connect

    Quote Originally Posted by dvanillailla View Post
    x10 won't let you import. They like inconveniencing people who don't start fresh with them.
    1) Copy SQL from your export from your database.
    2) Open PhpMyAdmin of your site.
    3) Click on SQL and paste the SQL from your exported database.
    CLICK HERE to Thank Me.
    (You must be logged in into forums.)

+ Reply to Thread
Page 1 of 2 12 LastLast

Similar Threads

  1. [PHP] MySQL and PHP
    By Bryon in forum Tutorials
    Replies: 43
    Last Post: 03-24-2011, 07:27 AM
  2. Problem with mysql and php
    By niraj.kumar.ait in forum Programming Help
    Replies: 8
    Last Post: 03-26-2008, 06:08 AM
  3. php and mysql help:i have an issue intergrating php and msql
    By mafisco27 in forum Programming Help
    Replies: 5
    Last Post: 03-18-2008, 12:35 AM
  4. linking PHP MySQL to Dreamweaver
    By samster5 in forum Free Hosting
    Replies: 2
    Last Post: 12-02-2007, 12:51 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
x10hosting free hosting for the masses
dedicated servers