RE: [PHP-DB] CREATE TABLE problem
Actually, it's more of an order problem: I fixed the SQL already. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Thursday, January 22, 2004 4:47 PM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: RE: [PHP-DB] CREATE TABLE problem 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:[EMAIL PROTECTED] Sent: 21 January 2004 22:34 To: [EMAIL PROTECTED] 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 titleUntitled 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) UNSIGNED NOT NULL AUTO_INCREMENT, 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 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.557 / Virus Database: 349 - Release Date: 12/30/2003 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] CREATE TABLE problem
If you're using MySQL, change to this: staffid int(3) unsigned not null auto_increment, The order of the attribute description is important in MySQL. -Original Message- From: js [mailto:[EMAIL PROTECTED] Sent: Thursday, January 22, 2004 6:34 AM To: [EMAIL PROTECTED] 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 titleUntitled 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 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] CREATE TABLE problem
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:[EMAIL PROTECTED] Sent: 21 January 2004 22:34 To: [EMAIL PROTECTED] 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 titleUntitled 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 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] CREATE TABLE problem
Regarding... -- $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) ); The problem with the above create table query is the _placement_ of the UNSIGNED keyword. Rather than: staffid INT(3) NOT NULL AUTO_INCREMENT UNSIGNED, try: staffid INT(3) UNSIGNED NOT NULL AUTO_INCREMENT, The second worked for me while the first threw the previously reported SQL Syntax error. HTH, David
Re: [PHP-DB] CREATE TABLE problem
hmm ... I have unsigned auto_increment fields in all my tables that use unique field IDs... But i use very long counter fields as it's pretty big tables I have (or gonna be once I get them finished)... FWIW Rene Fate would have it, that on Thu, 22 Jan 2004 08:47:01 -, [EMAIL PROTECTED] wrote: 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 Rene Brehmer aka Metalbunny http://metalbunny.net/ References, tools, and other useful stuff... -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] CREATE TABLE problem
mysql_db_query ($dbname,$query,$link) or die(myself_error()); will help you more than your if/then statement.. change that, and check out the error message. On Wed January 21 2004 2:33 pm, js wrote: 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 titleUntitled 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 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] CREATE TABLE problem redefined
js wrote: You have an error in your SQL syntax near 'UNSIGNED, name VARCHAR(255) NOT NULL, login VARCHAR(10) NOT NULL, password' at line 2 Print (echo) out your entire query. You have a syntax error before the point the error message mentions. -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals www.phparch.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php