Table not created...
Posted: Wed May 06, 2009 10:53 am
Hello... i'm working on a script which creates a mysql database, and inside it a table with rows... the problem is the table isn't created while the database is... this is the script:
what's wrong? 
Code: Select all
<html>
<head>
</head>
<body>
<?php
$connection = mysql_connect ("localhost", "root");
if (!$connection)
{
die ('Could not connect: ' . mysql_error());
}
if (mysql_query("CREATE DATABASE pepr",$connection))
{
print "Database create!";
}
else
{
print "Couldn't create database: " . mysql_error();
}
mysql_select_db("pepr",$connection);
$table = "CREATE TABLE users
(name varchar(15),
password varchar (30),
email varchar(30),
level varchar (2),
pending varchar (15),
banned varchar (15),
age varchar (15),
location varchar (30),
Age int
)";
mysql_query($table,$connection);
mysql_close($connection);
?>
</body>
</html>