PHP MYSQL Connect

LunarSage

New Member
Messages
4
Reaction score
0
Points
0
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.
 

garrettroyce

Community Support
Community Support
Messages
5,603
Reaction score
244
Points
63
Do you have port forwarding set for your home network?
 

LunarSage

New Member
Messages
4
Reaction score
0
Points
0
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...
 

sarvar

New Member
Messages
82
Reaction score
0
Points
0
PHP:
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:

Livewire

Abuse Compliance Officer
Staff member
Messages
18,168
Reaction score
215
Points
63
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 :)
 

LunarSage

New Member
Messages
4
Reaction score
0
Points
0
@sarvar
Yea your right I did miss that. Thanks :biggrin:

@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:

xav0989

Community Public Relation
Community Support
Messages
4,467
Reaction score
95
Points
0
You could create a xmlrpc server on your database server to fetch data...
 

leafypiggy

Manager of Pens and Office Supplies
Staff member
Messages
3,819
Reaction score
163
Points
63
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.
 

dvanillailla

New Member
Messages
9
Reaction score
0
Points
0
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.
 

sarvar

New Member
Messages
82
Reaction score
0
Points
0
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.
 

Livewire

Abuse Compliance Officer
Staff member
Messages
18,168
Reaction score
215
Points
63
x10 won't let you import. They like inconveniencing people who don't start fresh with them.


And to add to the previous user's numbers,

4: Check the last post date before bumping a topic from over a month ago.
 

tmv105

New Member
Messages
4
Reaction score
0
Points
0
You can also save your database as an SQL file and import to your x10hosting database.

  • Go to phpMyAdmin within your x10host
  • create database (I had to do this from MySQL not phpMyAdmin)
  • select import
  • locate your SQL file and voila....all of your tables are imported to your x10host db!
 
Top