bstafford Posted July 6, 2013 Share Posted July 6, 2013 Hello, Looking for help to solve this problem I have as this is new to me and now starting to learn. When I type in my website name, handcraftdesigns.co.uk I receive this error warning message. Warning: mysql_connect() [function.mysql-connect]: Unknown MySQL server host 'Handcraftdesigns' (0) in /home/content/26/10616326/html/admin/includes/functions/database.php on line 19Unable to connect to database server! I understand that I don't have the correct location names in my file, it is because I don't know how to properly type in the correct names needed, so looking for example of correct method. I am using OsCommerce 2.3.3 and have uploaded all my files via Filezilla and using Adobe DS3 to modify my files. Here is the file content of what I attempted, but have something incorrect here: <?php/* $Id$ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright © 2007 osCommerce Released under the GNU General Public License*/ function tep_db_connect($server = DB_SERVER, $username = DB_SERVER_USERNAME, $password = DB_SERVER_PASSWORD, $database = DB_DATABASE, $link = 'db_link') { global $$link; if (USE_PCONNECT == 'true') { $$link = mysql_pconnect("Handcraftdesigns.db.10616326.hostedresource.com", "Handcraftdesigns", "Password"); } else { $$link = mysql_connect("Handcraftdesigns.db.10616326.hostedresource.com", "Handcraftdesigns", "Password"); } if ($$link) mysql_select_db("Handcraftdesigns"); return $$link; } function tep_db_close($link = 'db_link') { global $$link; return mysql_close($$link); } Can someone please help me and explain what I have typed in wrong here to get the error, thanks Link to comment https://forums.phpfreaks.com/topic/279909-warning-mysql_connect-functionmysql-connect-unknown-mysql-server-host-handcraftdesigns-0adminincludes/ Share on other sites More sharing options...
jcbones Posted July 6, 2013 Share Posted July 6, 2013 Is your database server remote from your web server? On most hosts, the database server can be reached through the localhost. If you aren't sure if the database server is remote, then try using 'localhost' as the server name. Link to comment https://forums.phpfreaks.com/topic/279909-warning-mysql_connect-functionmysql-connect-unknown-mysql-server-host-handcraftdesigns-0adminincludes/#findComment-1439616 Share on other sites More sharing options...
bstafford Posted July 6, 2013 Author Share Posted July 6, 2013 @jcbones Hi, thanks for the reply on that, I am not sure if remote server or not, but I use GoDaddy dedicated Linux server and then uploaded all my files to that, I believe this is the way it is set up. I have replaced the name I had with "localhost" and still no access, but get these errors below. Warning: session_start() [function.session-start]: open(D:/Hosting/10616326/html/includes/work//sess_6g426fa1slc07sfv2cbd2ojha5, O_RDWR) failed: No such file or directory (2) in /home/content/26/10616326/html/admin/includes/functions/sessions.php on line 102Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home/content/26/10616326/html/admin/includes/functions/sessions.php:102) in /home/content/26/10616326/html/admin/includes/functions/sessions.php on line 102Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/content/26/10616326/html/admin/includes/functions/sessions.php:102) in /home/content/26/10616326/html/admin/includes/functions/sessions.php on line 102Warning: Cannot modify header information - headers already sent by (output started at /home/content/26/10616326/html/admin/includes/functions/sessions.php:102) in /home/content/26/10616326/html/admin/includes/functions/general.php on line 34Warning: Unknown: open(D:/Hosting/10616326/html/includes/work//sess_6g426fa1slc07sfv2cbd2ojha5, O_RDWR) failed: No such file or directory (2) in Unknown on line 0Warning: Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct (D:/Hosting/10616326/html/includes/work/) in Unknown on line 0 Thanks for the help, hoping to get into to this the rest of weekend and start adding product. Link to comment https://forums.phpfreaks.com/topic/279909-warning-mysql_connect-functionmysql-connect-unknown-mysql-server-host-handcraftdesigns-0adminincludes/#findComment-1439620 Share on other sites More sharing options...
bstafford Posted July 6, 2013 Author Share Posted July 6, 2013 @ jcbones, This is what is in the database.php file now. function tep_db_connect($server = DB_SERVER, $username = DB_SERVER_USERNAME, $password = DB_SERVER_PASSWORD, $database = DB_DATABASE, $link = 'db_link') { global $$link; if (USE_PCONNECT == 'true') { $$link = mysql_pconnect("localhost", "passord"); } else { $$link = mysql_connect(""localhost", "password"); } if ($$link) mysql_select_db("Handcraftdesigns"); return $$link; } function tep_db_close($link = 'db_link') { global $$link; return mysql_close($$link); } Link to comment https://forums.phpfreaks.com/topic/279909-warning-mysql_connect-functionmysql-connect-unknown-mysql-server-host-handcraftdesigns-0adminincludes/#findComment-1439621 Share on other sites More sharing options...
jcbones Posted July 6, 2013 Share Posted July 6, 2013 Godaddy always uses remote database connections (I hate godaddy, and this is one of the many reasons). So, assuming that you have created the database (and waited the hour or two that it needs to be active), log in to your control panel, go to databases, then actions, then details. Your hostname should be there, and that is what you should have for your DB_SERVER constant. You then need to change your file back to what it was originally, and put your changes wherever your constants are defined. Link to comment https://forums.phpfreaks.com/topic/279909-warning-mysql_connect-functionmysql-connect-unknown-mysql-server-host-handcraftdesigns-0adminincludes/#findComment-1439644 Share on other sites More sharing options...
Ken_GoDaddy Posted July 9, 2013 Share Posted July 9, 2013 @bstafford, I'm with Go Daddy and came across your post. @jcbones is correct in that you will need to create the database, then go into your control panel to locate the hostname. More information on locating the host name can be found here: http://support.godaddy.com/help/article/39/locating-your-databases-host-name If you are still running into any issues please feel free to reply or send me a private message with any additional details. Link to comment https://forums.phpfreaks.com/topic/279909-warning-mysql_connect-functionmysql-connect-unknown-mysql-server-host-handcraftdesigns-0adminincludes/#findComment-1440093 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.