Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

The Database Forum


You are currently viewing our The Database Forum as a guest. Please register to participate.
Login



Reply
Trouble creating a MySQL Table..
Old 05-22-2006, 03:31 PM Trouble creating a MySQL Table..
Novice Talker

Posts: 8
Trades: 0
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.

Quote:
<?

$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!");

?>
virtuexru is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 05-22-2006, 04:10 PM Re: Trouble creating a MySQL Table..
Novice Talker

Posts: 8
Trades: 0
OK, well I figured something out, I changed the

Quote:
mysql_query($query);
echo("Success!");
to

Quote:
$result = mysql_query($query);
if($result)
echo "Success!";
else
echo "There was an error!" . mysql_error();
but then I got..

Quote:
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
virtuexru is offline
Reply With Quote
View Public Profile
 
Old 05-22-2006, 04:28 PM Re: Trouble creating a MySQL Table..
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,519
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
column names cannot contain spaces
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 05-22-2006, 04:32 PM Re: Trouble creating a MySQL Table..
Novice Talker

Posts: 8
Trades: 0
Ah I feel like an idiot, but what do you mean? I tried this: but I still got the same error..

Quote:
$user="andiamop";
$password="1200baud";
$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,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))";
$result = mysql_query($query);
if($result)
echo "Success!";
else
echo "There was an error!" . mysql_error();
?>
virtuexru is offline
Reply With Quote
View Public Profile
 
Old 05-22-2006, 04:38 PM Re: Trouble creating a MySQL Table..
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,519
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
sorry mis read the list

text fields don't have a size parameter so you cannot have text(nnn)
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 05-22-2006, 04:41 PM Re: Trouble creating a MySQL Table..
Novice Talker

Posts: 8
Trades: 0
Ah! Freakin' amazing. Thanks a lot.
virtuexru is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Trouble creating a MySQL Table..
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.23114 seconds with 12 queries