Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Feb 2009
    Posts
    90
    Thanks
    5
    Thanked 0 Times in 0 Posts

    setting up a new database - access denied

    I'm setting up a database and have never done so before so I'l talk you through what I have done, in phpmyadmin I exported this text file to create the database as below

    Code:
    CREATE TABLE calendar_events (	id INT NOT NULL PRIMARY KEY AUTO_INCREMENT,	event_title 
    
    VARCHAR (25),	event_shortdesc VARCHAR (255),	event_start DATETIME);
    So this gives me the calendar_events table created ok and everything seems fine in phpmyadmin

    But when I go to connect to the database through a php script I get
    Access denied for user 'djpromoc3'@'%' to database 'calendar_events'

    the php is below
    PHP Code:
    <?php
    $mysql 
    mysql_connect("myhost""djpromoc3""mypassword");
    mysql_select_db("calendar_events"$mysql) or die(mysql_error());
    ?>
    All my host usernames and passwords are ok, is there something else I have missed?

  • #2
    UE Antagonizer Fumigator's Avatar
    Join Date
    Dec 2005
    Location
    Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
    Posts
    7,691
    Thanks
    42
    Thanked 637 Times in 625 Posts
    You are creating a table calendar_events, but then you are trying to select a database named calendar_events... a table is not the same thing as a database.


  •  

    Posting Permissions

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