virtuexru Posted May 22, 2006 Share Posted May 22, 2006 This is my first post here so, hopefully I will get some good responses. I have no idea why this table just does not come up on my Database table list. I have tried loads of things, any suggestions? It's probably some stupid error I'm missing. Thanks a lot.[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]<?$user="****";$password="****";$database="mydb";mysql_connect(localhost,$user,$password);@mysql_select_db($database) or die( "Unable to select database");$query="CREATE TABLE joborder (id int(6) NOT NULL auto_increment,title varchar(25) NOT NULL,number varchar(15) NOT NULL,desc text(200) NOT NULL,category varchar(20) NOT NULL,salary varchar(10) NOT NULL,addcomp varchar(20) NOT NULL,position varchar(20) NOT NULL,location varchar(20) NOT NULL,details text(350) NOT NULL,PRIMARY KEY (id),UNIQUE id (id),KEY id_2 (id))";mysql_query($query);echo("Success!");?>[/quote] Quote Link to comment https://forums.phpfreaks.com/topic/10204-trouble-creating-a-mysql-form/ Share on other sites More sharing options...
ober Posted May 22, 2006 Share Posted May 22, 2006 Change:[code]mysql_query($query);echo("Success!");[/code]To:[code]$result = mysql_query($query);if($result) echo "Success!";else echo "There was an error!" . mysql_error();[/code]And tell us what you get. It would also help if you had access to phpmyadmin and you could create the table through there (or at least run the SQL through there) and see if you get anything. Quote Link to comment https://forums.phpfreaks.com/topic/10204-trouble-creating-a-mysql-form/#findComment-38017 Share on other sites More sharing options...
virtuexru Posted May 22, 2006 Author Share Posted May 22, 2006 OK, did that, then I got this error:[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]There was an error!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 'desc text(200) NOT NULL, category varchar(20) NOT NULL, sal [/quote] Quote Link to comment https://forums.phpfreaks.com/topic/10204-trouble-creating-a-mysql-form/#findComment-38018 Share on other sites More sharing options...
virtuexru Posted May 22, 2006 Author Share Posted May 22, 2006 Here are the errors from MySQL:[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]SQL query: CREATE TABLE joborder(id int( 6 ) NOT NULL AUTO_INCREMENT ,title varchar( 25 ) NOT NULL ,number varchar( 15 ) NOT NULL ,description text( 200 ) NOT NULL ,category varchar( 20 ) NOT NULL ,salary varchar( 10 ) NOT NULL ,addcomp varchar( 20 ) NOT NULL ,position varchar( 20 ) NOT NULL ,location varchar( 20 ) NOT NULL ,details text( 350 ) NOT NULL ,PRIMARY KEY ( id ) ,UNIQUE id( id ) ,KEY id_2( id ) ) MySQL said: #1064 - 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 '(200) NOT NULL,category varchar(20) NOT NULL,salary varchar(10) [/quote][b]Figured it out, can't define a TEXT field with a number value![/b] Quote Link to comment https://forums.phpfreaks.com/topic/10204-trouble-creating-a-mysql-form/#findComment-38025 Share on other sites More sharing options...
ober Posted May 22, 2006 Share Posted May 22, 2006 Well the first one probably came from the fact that you were using "desc" as a column name... that's a keyword.I'm not sure what the second error is from. Quote Link to comment https://forums.phpfreaks.com/topic/10204-trouble-creating-a-mysql-form/#findComment-38029 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.