problema creazione query con campo float

luigi777

Utente Attivo
14 Feb 2008
1.086
1
38
43
Massa, Italy
salve, chi è che mi dice dove si trova l'errore?
Sto imparando ad usare pdo e sto creando un piccolo progetto utile..ma non so il motivo perché
mi da errore sintassi quando creo le tabelle a runtime con codice php.

PHP:
<?php
include("inc.php");
?>
<?php
$pdo->query("CREATE TABLE IF NOT EXISTS primanota ( 
    id int unsigned auto_increment,
	int giorno,
	int mese,
	int anno,
	descrizione text,
	importo_cassa float,
	importo_banca float,
    data  datetime,
	_update TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
	PRIMARY KEY  ('id'))  ENGINE = MyISAM DEFAULT CHARSET=utf8;
	");
?>

errore:
Codice:
Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[42000]: Syntax error or access violation: 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 'int giorno, int mese, int anno, descrizione text, importo_cassa float, ' at line 3' in D:\xampp\htdocs\PrimaNota\setup\create.php:16 Stack trace: #0 D:\xampp\htdocs\PrimaNota\setup\create.php(16): PDO->query('CREATE TABLE IF...') #1 {main} thrown in D:\xampp\htdocs\PrimaNota\setup\create.php on line 16

che è ???

grazie mille.
 
anche in phpmyadmin da errore:

Errore
Query SQL:


CREATE TABLE IF NOT EXISTS primanota (
id int unsigned auto_increment,
int giorno,
int mese,
int anno,
descrizione longtext,
importo_cassa float,
importo_banca float,
data datetime,
_update TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY ('id')) ENGINE = MyISAM DEFAULT CHARSET=utf8
Messaggio di MySQL: Documentazione

#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 'int giorno,
int mese,
int anno,
descrizione longtext,
importo_cassa floa' at line 3
 
risolto... ho messo int giorno, int mese, etc.. invece vanno messi dopo giorno int, mese int.
ho fatto un po di casino..
grazie lo stesso.
 

Discussioni simili