Results 1 to 4 of 4
  1. #1
    Junior Member
    Join Date
    Dec 2006

    Question Newbie: need help quick with sql and php

    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";
    $password="I put in my password for";


    @mysql_select_db($database) or die("Unable to select database");

  2. #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.


  3. #3
    Moderator wildjokerdesign's Avatar
    Join Date
    Jun 2003
    Kansas City Mo


    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.
    Please remember your charity of choice:

    Handy Links: | Plain Text Editors: EditPlus | Crimson

  4. #4
    Junior Member
    Join Date
    Dec 2006

    Smile Thanks guys!

    Thanks! I finally got it to connect. You are lifesavers.

Similar Threads

  1. PHP and Microsoft SQL Server - Connection help
    By braestjohn in forum PHP / MySQL
    Replies: 1
    Last Post: 12-06-2007, 02:13 PM
  2. New to PHP / SQL
    By davedup in forum PHP / MySQL
    Replies: 3
    Last Post: 12-21-2006, 01:53 PM
  3. Best HTML PHP SQL Editor
    By AndreyPopov in forum PHP / MySQL
    Replies: 3
    Last Post: 01-12-2005, 08:38 PM
  4. Using PHP to connect to remote Microsoft SQL server
    By Village Hermit in forum PHP / MySQL
    Replies: 0
    Last Post: 10-26-2004, 12:17 AM
  5. PHP script to run a club.
    By Armadillo in forum PHP / MySQL
    Replies: 5
    Last Post: 05-19-2004, 10:17 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts