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.

PHP Forum


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



Freelance Jobs

Reply
error when using decimal&int types
Old 04-25-2005, 11:16 AM error when using decimal&int types
hiptobesquare's Avatar
Extreme Talker

Posts: 186
Location: London UK
Trades: 0
hi. quite new to mysql and ive stumbled accross a frustrating glitch. in creating my mysql table i get an error if i try to assign an int or decimal value to any of my fields. assigning a char value works but thats no good for me as i need to use values of my fields in php equations. the sql code i entered is as follows:

create table price (
frosted white decimal(6,2)not null,
silver mirror decimal(6,2)not null,
tinted mirror (grey, green, bronze) decimal(6,2) not null,
tinted mirror blue decimal(6,2)not null,
tinted mirror pink decimal(6,2)not null,
frosted mirror decimal(6,2) not null,
woodgrain (light, medium, dark) decimal(6,2) not null,
primary key(frosted white) )


And the error:

Error 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 'white decimal(6,2)not null, silver mirror decimal(6,2)not null, tinted mirror ' at line 2.

if i was to change all of decimal in the above sql commands to char(10) it would work. if i changed them to int(..) id get an error.

the mysql, php, and apache im using came bundled from www.apachefriends.com (xampp) and i wonder if its anything to do with that. i spent a long time trying to configure each program seperately but gave up after i found out xampp configured everything automatically in a few clicks.


Help would be much appreciated.


Mark
hiptobesquare is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 04-26-2005, 07:43 AM
Gary_Pinkett's Avatar
Junior Talker

Posts: 4
Trades: 0
Have you tried DOUBLE ?
__________________
Classic Gaming for the Next Generation,
Please login or register to view this content. Registration is FREE
Gary_Pinkett is offline
Reply With Quote
View Public Profile Visit Gary_Pinkett's homepage!
 
Old 04-26-2005, 07:52 AM
Republikin's Avatar
Defies a Status

Posts: 3,189
Trades: 3
Try taking out the spaces in the table names...

silver_mirror

MySQL reads the space and is looking for the next keyword, at least that is my guess.
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
Republikin is offline
Reply With Quote
View Public Profile
 
Old 04-27-2005, 11:09 AM
hiptobesquare's Avatar
Extreme Talker

Posts: 186
Location: London UK
Trades: 0
Thanks for getting back to me. Firstly i dont know what doubles are but ive rectified the problem by changing the numbers in my table headings (000-614,615-762 etc) to words ie- small medium large. strange because ive 3 books about mysql and none of them say anything about not being able to use numbers as headings..




edited: sorry what ive written above refers to an earlier version of the table i thought id posted up top there. looking at what i posted up there ive no idea what i did differently but it does work now. There is still spaces betweent he heading on my new table.

Last edited by hiptobesquare; 04-27-2005 at 11:16 AM..
hiptobesquare is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to error when using decimal&int types
 

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.26323 seconds with 12 queries