I'm using DreamWeaver to create a website. I need to be able to update information in a database from my website. Anyway, I created a database named "symptominformation" and a table named "information" in PHPMyAdmin. I now need to be able to connect to that database in DreamWeaver. I've been using PHP inside dreamweaver and it worked for sending forms, but now it won't let me connect.
I used this code and I get the "Unable to select database." Can anyone help me?
$username="I put in my username for westhost.com";
$password="I put in my password for westhost.com";
@mysql_select_db($database) or die("Unable to select database");
Results 1 to 4 of 4
12-12-2006, 03:54 PM #1
- Join Date
- Dec 2006
Newbie: need help quick with sql and php
12-12-2006, 04:40 PM #2
Two quick items at first glance....
1. The default username for MySQL is 'root', so unless you have set up a different user for mysql, try using root.
2. You are closing your database connection right after you connect, so that is probably why the mysql_select_db() is failing.
If that still doesn't work then try putting your mysql_connect() in an "if" statement to ensure that you are successfully connecting to the database in the first place.
Let us know if that doesn't work.
12-13-2006, 06:39 AM #3
To add to what Blender has suggested don't forget to enable remote access to the MySQL database in your Site Manager. Also the password for the database would not be the same as that for your main site log in unless you entered that same password when you installed MySQL via the Site Manager.
It might be best to create a new user and password in phpMyAdmin other then the default. Click on the Permissions link and then you'll see the link to create a new user.
Don't forget the links to documentation on both MySQL and phpMyAdmin that are in the phpMyAdmin program. They can answer many basic questions that may arise.
12-19-2006, 04:25 PM #4
- Join Date
- Dec 2006
Thanks! I finally got it to connect. You are lifesavers.
By braestjohn in forum PHP / MySQLReplies: 1Last Post: 12-06-2007, 02:13 PM
By davedup in forum PHP / MySQLReplies: 3Last Post: 12-21-2006, 01:53 PM
By AndreyPopov in forum PHP / MySQLReplies: 3Last Post: 01-12-2005, 08:38 PM
By Village Hermit in forum PHP / MySQLReplies: 0Last Post: 10-26-2004, 12:17 AM
By Armadillo in forum PHP / MySQLReplies: 5Last Post: 05-19-2004, 10:17 PM