PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
<?php
$server = "localhost"; // server to connect to.
$database = "*****"; // the name of the database.
$db_user = "*****"; // mysql username to access the database with.
$db_pass = "*****";
// connect to the mysql server
$link = mysql_connect($server, $db_user, $db_pass)
or die ("Could not connect to mysql because ".mysql_error());
// select the database
mysql_select_db($database)
or die ("Could not select database because ".mysql_error());
// create table on database
$create = "CREATE TABLE `members` (
`id` int(5) NOT NULL auto_increment,
`name` varchar(30) NOT NULL default '',
`uname` varchar(50) NOT NULL default '',
`email` varchar(200) NOT NULL default '',
`password` varchar(10) NOT NULL default '',
`bmonth` varchar(40) NOT NULL default '',
`byear` varchar(40) NOT NULL default '',
`bday` varchar(40) NOT NULL default '',
`status` enum('N','Y') NOT NULL default 'N',
`code` char(6) NOT NULL default '',
`joindate` date NOT NULL default '0000-00-00',
`login` datetime NOT NULL default '0000-00-00 00:00:00',
PRIMARY KEY (`id`),
UNIQUE KEY `name` (`name`,`email`,`uname`),
UNIQUE KEY `uname`
UNIQUE KEY `email` )
TYPE=MyISAM AUTO_INCREMENT=1;";
mysql_query($create)
or die ("Could not create tables because ".mysql_error());
echo "Complete.";
?>
Could not create tables because You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'UNIQUE KEY `email` ) TYPE=MyISAM AUTO_INCREMENT=1' at line 17
Could not create tables because You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'UNIQUE KEY `email` ) TYPE=MyISAM, AUTO_INCREMENT=1' at line 1