# PHP MySQL question

**URL:** https://forum.kirupa.com/t/php-mysql-question/233868
**Category:** Uncategorized
**Created:** [July 27, 2007, 4:11pm UTC](https://forum.kirupa.com/t/php-mysql-question/233868 "2007-07-27T16:11:50Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![suz](https://avatars.discourse-cdn.com/v4/letter/s/3d9bf3/32.png) [@suz](https://forum.kirupa.com/u/suz)
#### Post date: [July 27, 2007, 4:11pm UTC](https://forum.kirupa.com/t/php-mysql-question/233868/1 "2007-07-27T16:11:50Z")

</div>

i’m trying to follow this tutorial to build a Php and MySql image gallery but am running into a few problems as i’m not very advanced with php.

tutorial is here [http://www.sitepoint.com/article/php-gallery-system-minutes](http://www.sitepoint.com/article/php-gallery-system-minutes)

I have set up the database in PHP MyAdmin using the WAMP server. I have also downloaded the files that i need for the tutorial and am editing them as I go.

I am on Pg 1 of the tutorial, and having exported my database - i called it ‘gallery’ i saved it as a .txt file and have put it in the www directory of the WAMP server along with the other php files.

Problem is I can’t seem to connect to the database even though i have changed the name of the database to gallery.

when i run the page on the localhost i get the following error messages

```php

Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'root'@'localhost' (using password: YES) in C:\wamp\www\config.inc.php on line 4

Warning: mysql_select_db() [function.mysql-select-db]: Access denied for user 'ODBC'@'localhost' (using password: NO) in C:\wamp\www\config.inc.php on line 5

Warning: mysql_select_db() [function.mysql-select-db]: A link to the server could not be established in C:\wamp\www\config.inc.php on line 5
Could not select database

```

So I am assuming it is something to do with the user and password.

Here is my code here -

```php
<?php
    // Before implementing this code, you should use your own username, password and database name values.

    $mysql_link = mysql_connect("localhost", "root", "root");   
     mysql_select_db("gallery") or die("Could not select database");

    $images_dir = "photos";
?>

```

can anyone help? I’m sort of on a tight deadline for to do this.

thanks in advance :nerd:
