Go Back   HostGator Peer Support Forums > General Discussion > Webhosting

Notices

Reply
 
Thread Tools
  #1  
Old 06-29-2005, 08:31 PM
tvg tvg is offline
Hatchling Croc
 
Join Date: Feb 2005
Posts: 2
Question MySql path, can't find or connect to it

I have a site, I have the database, I can't get them to connect?

I am working in dreamweaver and trying to set up a testing server from hostgator servers so I can test it locally before I upload...

I can't find the database? Where is it on the server and how do I connect?

I need help please, this is the first time I've tried to work with mysql and php on a host server other than my local computer.

Thank you
Reply With Quote
  #2  
Old 06-30-2005, 04:24 PM
Tomer Tomer is offline
Hatchling Croc
 
Join Date: Jun 2005
Posts: 23
Default Re: MySql path, can't find or connect to it

First you need to create a database/user via cPanel -> MySQL Databases.

Second you need to connect to the database via PHP script:

PHP Code:
 <?php
 
 
// Connect.
 
mysql_connect($host$user$pass)
 or die (
"Couldn't connect to database.");
 
 
// Select database.
 
mysql_select_db($database)
 or die (
"Couldn't select database.");
 
 
// Execute query...
 
$result mysql_query("query");
 
 
?>
You will need to define the variables. Note that $host will usually be localhost.

Good luck
Reply With Quote
Reply

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Escape: mysql_connect(): Can't connect to local MySQL server through socket RyanM Shared Hosting Support 6 10-02-2006 05:45 PM
xeoman guestbook/ mysql help needed marlies63 Shared Hosting Support 2 01-31-2005 02:42 PM
MegaDJ. MySQL can't connect to database error megadj Network Status 4 01-27-2005 05:47 PM

All times are GMT -5. The time now is 05:47 PM.