dzhax Posted December 15, 2009 Share Posted December 15, 2009 I am making a page and i run my connection define("MYSQL_Url", "IP"); //default localhost, only change if your database is not on your webserverdefine("MYSQL_Username", "USER"); //Default phpmyadmin logindefine("MYSQL_Password", "PASS"); //Default phpmyadmin logindefine("DATABASE_Prefix", "ASSIGNED PREFIX"); //The prefix is a standard name before each table for organizationdefine("DATABASE_Name", "serverStatus"); //Name of database you wish to connect to to receive inforamtiondefine("TABLE_Name", "server_status"); //Name of table you wish to connect to to receive inforamtion$mysqlConnection = mysql_connect(MYSQL_Url,MYSQL_Username,MYSQL_Password);echo $mysqlConnection; Resource id #2 <- that is what echosIs that bad or good? because when i run my query to create a table it errors $databaseConnection = mysql_select_db(DATABASE_Prefix . DATABASE_Name,$mysqlConnection);echo $databaseConnection 1 <- that is what echos $sql = 'CREATE TABLE IF NOT EXISTS `server_status` ( `id` BIGINT( 20 ) NOT NULL AUTO_INCREMENT PRIMARY KEY, `name` LONGTEXT NOT NULL, `server_ip` TEXT NOT NULL, `port` TEXT NOT NULL, `username` TEXT NOT NULL, `password` TEXT NOT NULL, `votes` BIGINT(20) NOT NULL DEFAULT \'0\', `url` LONGTEXT NOT NULL, `description` LONGTEXT NULL, `type` TEXT NULL, `uptime_yes` BIGINT(20) NOT NULL DEFAULT \'0\', `uptime_no` BIGINT(20) NOT NULL DEFAULT \'0\', PRIMARY KEY (`id`)) ENGINE = MyISAM';$queryExecution = mysql_query($sql, $mysqlConnection) or print( mysql_error(0) . ' - Error 2<br /> <br />');echo $queryExecution . '<br /> <br />'; Warning: mysql_error(): supplied argument is not a valid MySQL-Link resource in C:\www\vhosts\localhost\bot\index.php on line 20- Error 2that is what prints... the echo portion does not appear to echo... so there must be a mysql error their...Line 20: $queryExecution = mysql_query($sql, $mysqlConnection) or print( mysql_error(0) . ' - Error 2<br /> <br />');any help?oh this is a remote connection i am using.. the page is hosted on my home web server and the database is on my remote web hosts server Link to comment Share on other sites More sharing options...
justsomeguy Posted December 15, 2009 Share Posted December 15, 2009 Resource id #2 <- that is what echosIs that bad or good? because when i run my query to create a table it errorsIt's not really either, mysql_connect returns a resource, and you're trying to print a resource. You're not checking for errors when you connect or select the database though. It might be that the database server does not allow remote connections. Link to comment Share on other sites More sharing options...
dzhax Posted December 16, 2009 Author Share Posted December 16, 2009 It's not really either, mysql_connect returns a resource, and you're trying to print a resource. You're not checking for errors when you connect or select the database though. It might be that the database server does not allow remote connections.Remote connection is allowed. and exception has been passed. Link to comment Share on other sites More sharing options...
Synook Posted December 16, 2009 Share Posted December 16, 2009 Have you tried echoing mysql_error() to see what the error actually is? Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.