# \[php & MySQL\] Creating database and tables not working!

**URL:** <https://forum.kirupa.com/t/php-mysql-creating-database-and-tables-not-working/221716>\
**Category:** programming\
**Created:** [April 6, 2007, 5:28pm UTC](https://forum.kirupa.com/t/php-mysql-creating-database-and-tables-not-working/221716 "2007-04-06T17:28:26Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![chrisclick](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/chrisclick/32/1991_2.png) [@chrisclick](https://forum.kirupa.com/u/chrisclick)\
**Post date:** [April 6, 2007, 5:28pm UTC](https://forum.kirupa.com/t/php-mysql-creating-database-and-tables-not-working/221716/1 "2007-04-06T17:28:26Z")

</div>

\*\*Hi all,  
\*\*Not having such a good time at the moment. I have made a script from tutorials on how to create a MySQL database with PHP and I can do it its just when I want to add my second table it will not work.

this is the PHP code of the create.php file:

```php
<?php
include 'config.php';
include 'opendb.php';

$query = 'CREATE DATABASE blog779';
$result = mysql_query($query);

mysql_select_db('blog779') or die('Cannot select database');

$query = 'CREATE TABLE admin( '.
         'id INT NOT NULL AUTO_INCREMENT, '.
         'username TEXT NOT NULL, '.
         'password TEXT NOT NULL, '.
         'email TEXT NOT NULL, '.
         'PRIMARY KEY(id))';

         'CREATE TABLE admin( '.
         'id INT NOT NULL AUTO_INCREMENT, '.
         'username TEXT NOT NULL, '.
         'password TEXT NOT NULL, '.
         'email TEXT NOT NULL, '.
         'PRIMARY KEY(id))';

         

$result = mysql_query($query);

include 'closedb.php';
?>

```

can you see anything wrong?
