Jump to content

Trouble creating a MYSQL Form..


virtuexru

Recommended Posts

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]
Link to comment
Share on other sites

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.
Link to comment
Share on other sites

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]
Link to comment
Share on other sites

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]
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.