RE: [PHP-DB] CREATE TABLE problem
| From: | N dot A dot Morgan at bton dot ac dot uk | Date: | Thu, 22 Jan 2004 08:47:01 +0000 |
| Subject: | RE: [PHP-DB] CREATE TABLE problem | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-32579@lists.php.net to get a copy of this message | ||
I have had similar problems before. I have just created your table in
MySQL. Seems you can't have an AUTO_INCREMENT column that is UNSIGNED.
Doesn't mention this in the manual though.
Neil Morgan
-----Original Message-----
From: js [mailto:james@invividly.com]
Sent: 21 January 2004 22:34
To: php-db@lists.php.net
Subject: [PHP-DB] CREATE TABLE problem
ok im making this page and every single time i try to execute it, it tells
me it was not successful. the database name, user,pw,and local host are all
correct. i have no idea what do do, and i have 2 more tables besides this
one i wanted to create but this was kind of my template for it and i cant
even get it to work. im still really bad with this kind of stuff so any help
i could get from you is really appreciated. thanks. here is the code:
<html>
<head>
<title>Untitled Document</title>
</head>
<body>
<?php
$host = "localhost";
$user = "user";
$password = "";
$dbname = "swwdb";
$link = mysql_connect($host,$user,$password);
$query = "CREATE TABLE staff (
staffid INT(3) NOT NULL AUTO_INCREMENT UNSIGNED,
name VARCHAR(255) NOT NULL,
login VARCHAR(10) NOT NULL,
password VARCHAR(8) NOT NULL,
picaddy VARCHAR(255) NOT NULL,
email VARCHAR(255) NOT NULL,
staffbio TEXT NOT NULL,
createdate DATE NOT NULL,
tagline VARCHAR(255) NOT NULL,
PRIMARY KEY(staffid,login) )";
if (mysql_db_query ($dbname,$query,$link)) {
print ("the query was successfull");
} else {
print ("the query was NOT success");
}
mysql_close($link);
?>
</body>
</html>