hi!
I'm completely new to PHP and MySQL and I am using WAMP 5.This is something I extracted from a web tutorial. Although it is to create a table called students in a database named College it does not create one.
Can someone pls show me where I have gone wrong in the following codings?
[code=php]
<?
$username="root ";
$password="";
$database="Coll ege";
$name=$_POST['name'];
$dob=$_POST['dob'];
mysql_connect(l ocalhost,$usern ame,$password);
@mysql_select_d b($database) or die( "Unable to select database");
if (mysql_is_table ('localhost', $username, $password, $database, 'Students')) {
$query="CREATE TABLE Students (index int(6) NOT NULL auto_increment, Name varchar(20) NOT NULL,DoB varchar(15) NOT NULL)";
} else {
$query = "INSERT INTO Students VALUES ('','$name','$d ob')";
}
mysql_query($qu ery);
mysql_close();
?>[/code]
[Please use CODE tags when posting source code. Thanks! --pbmods]
I'm completely new to PHP and MySQL and I am using WAMP 5.This is something I extracted from a web tutorial. Although it is to create a table called students in a database named College it does not create one.
Can someone pls show me where I have gone wrong in the following codings?
[code=php]
<?
$username="root ";
$password="";
$database="Coll ege";
$name=$_POST['name'];
$dob=$_POST['dob'];
mysql_connect(l ocalhost,$usern ame,$password);
@mysql_select_d b($database) or die( "Unable to select database");
if (mysql_is_table ('localhost', $username, $password, $database, 'Students')) {
$query="CREATE TABLE Students (index int(6) NOT NULL auto_increment, Name varchar(20) NOT NULL,DoB varchar(15) NOT NULL)";
} else {
$query = "INSERT INTO Students VALUES ('','$name','$d ob')";
}
mysql_query($qu ery);
mysql_close();
?>[/code]
[Please use CODE tags when posting source code. Thanks! --pbmods]
Comment