Page 1 of 1
mysql-front error
Posted: Sun Nov 23, 2003 6:58 pm
by kumarsena
hey
im using mysl frontend to crete a databse and im trying to insert fields in the tabel but i get the following error.
i tried to insert a field called albumName with type TEXT value 35 and default 0
any help, please!!
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 '(35) DEFAULT '0')' at line 1
thanks
kumar
Posted: Sun Nov 23, 2003 7:29 pm
by microthick
I don't know if you can have a field of type text with a default value.
You might have to make the field a varchar instead.
Posted: Sun Nov 23, 2003 7:29 pm
by infolock
can you show us the query statement you are using ?
Posted: Sun Nov 23, 2003 8:02 pm
by kumarsena
got it sorted guys. i just had to remove the length/set atribute. im not sure what this is for, but without is it works fine...can anyine tell what the lenght/set is for?
thnx
kumar
Posted: Sun Nov 23, 2003 8:24 pm
by d3ad1ysp0rk
length is for the amount of characters in the variable
ie. length of 3 means you can have bobby (5 chars), they'd have to do bob (3 chars), etc
Posted: Sun Nov 23, 2003 11:24 pm
by kumarsena
tnx
Posted: Tue Nov 25, 2003 6:37 pm
by xinelo
hello.
i´ve got the same problem. i tried removing the length attribute but still it doesn´work
i´m running easyphp1-7 (mysql 4.0.15, php 4.3.3 and apache 1.3.27) under windows XP
thanks for reading, i hope someone can help
and this is what i get
Error
SQL-query :
CREATE TABLE 't_termino'(
'cle_fr'varchar( 250 ) ,
'gram_fr'varchar( 250 ) ,
'src_cle_fr'varchar( 250 ) ,
'var_fr'varchar( 250 ) ,
'syn_fr'varchar( 250 ) ,
'autre_forme_fr'varchar( 250 ) ,
'gram_autre_forme_fr'varchar( 250 ) ,
'nt_fr'text,
'src_nt_fr'varchar( 250 ) ,
'nl_fr'text,
'src_nl_fr'varchar( 250 ) ,
'cle_en'varchar( 250 ) ,
'gram_en'varchar( 10 ) ,
'src_cle_en'varchar( 250 ) ,
'var_en'varchar( 250 ) ,
'syn_en'varchar( 250 ) ,
'autre_forme_en'varchar( 250 ) ,
'gram_autre_forme_en'varchar( 250 ) ,
'nt_en'text,
'src_nt_en'varchar( 250 ) ,
'nl_en'text,
'src_nl_en'varchar( 250 ) ,
'++'varchar( 250 ) ,
'code_op_fr'varchar( 250 ) ,
'code_op_en'varchar( 250 ) ,
'champ'varchar( 250 ) ,
'combinatoire_fr'text,
'combinatoire_en'text,
'valideur_en'varchar( 250 ) ,
'valideur_fr'varchar( 250 ) ,
'domaine'varchar( 250 ) ,
'fiche_douteuse'char( 1 ) NOT NULL default ''
) TYPE = MYISAM
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 ''t_termino'( 'cle_fr'varchar( 250 ) ,
'gram_fr'varchar( 250
Posted: Wed Nov 26, 2003 3:34 am
by kumarsena
hey,
anyone who help xinelo...?
Posted: Wed Nov 26, 2003 5:36 am
by Weirdan
You have to enclose your field names into backticks (`) and do not forget spaces after field name:
Code: Select all
//was
'cle_fr'varchar( 250 ) ,
//should be
`cle_fr` varchar( 250 ) ,
Table name should be enclosed into backticks also:
Code: Select all
//was
CREATE TABLE 't_termino'(
//should be
CREATE TABLE `t_termino`(
alright!
Posted: Wed Nov 26, 2003 1:00 pm
by xinelo
thanks you both, weirdan and kumarsena
it works now, using backticks... however i do include a space after fields names, but what i posted is what phpmyadmin returns with the error message
so i actually input:
'cle_fr' varchar(250),
and got (on the error message):
'cle_fr'varchar( 250 ) ,
that is, no space between the field name and the attribute and extra spaces between the length, the brackets and even the comma. weird...
but hey, it works now, thanks a lot!
