I use the following to delete a column from a table:

$columns= "'col1','col2','col3','col4','col5'";
$this->open_db(); //get the resource number($this->c_id)
$r=sqlite_query($this->c_id,"CREATE TEMPORARY TABLE
$r=sqlite_query($this->c_id,"INSERT INTO 'backup'
SELECT $columns FROM '$table_name'");
$r=sqlite_query($this->c_id,"DROP TABLE '$table_name'");
$r=sqlite_query($this->c_id,"CREATE TABLE '$table_name'($columns)");
INTO'$table_name' SELECT $columns FROM 'backup'");
$r=sqlite_query($this->c_id,"DROP TABLE 'backup'");

What happens is that 
"INSERT INTO 'backup'SELECT $columns FROM '$table_name'" 
populates the 'backup' table with
the names of the columns instead of the content of the columns. If I
unquote the columns names in $columns (col1,col2,col3...) the new table
is populated with the content, which is the correct behaviour. 
Trouble is that I prefer quoting column names in case they have more
words then one.
Same problem happened with my 'add column' function but I was able to
fix that selecting *  as opposed to $columns for populating the
temp table. 
I am pretty sure this is not sqlite behavior in console.
Any help will be appreciated, thanks.
This extension is new and probably still has bugs and undocumented features but
I've used sqlite in other applications and it kicks ass, for most web applications
anything bigger is overkill.

Regards, Andu Novac

PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to