Page 1 of 1

Adding New Collumns

Posted: Mon Dec 29, 2003 9:18 am
by Straterra
I get this error :

Warning: sqlite_query(): near "ALTER": syntax error in c:\ftp\users\straterra\eck\cgi-bin\newcollumn.php on line 7


When I use this code :

Code: Select all

<?php
$dbname = 'eckbios';
if ($db = sqlite_open($dbname, 0666, $sqliteerror)){
sqlite_query($db, "ALTER TABLE clanprofile
ADD bgcolor VARCHAR (30),
ADD textcolor VARCHAR (30)
");
} else {
  die ($sqliteerror);
}
?>
Can anyone tell me what I did wrong?

Posted: Mon Dec 29, 2003 9:35 am
by Straterra
I found out why. SQLite doesn't support the ALTER command. I have to put the table data into a temporary table and delete the old table, then create a new table with the new collumns and then insert the data from the temporary table into that...Anyone know how to do that?