php - creating a table using $_POST parameters -
i'm trying create table wich name parameter. possible? this:
$result = pg_query("create table '$_post[nome_arquivo_software]' ( id serial constraint pk_'$_post[nome_arquivo_software]' primary key, nome varchar (80), email varchar (80), estado varchar (80), acessos numeric )");
the table name not string literal identifier -> change single-quote double-quotes -> quoted identifier.
the name of id field not pk_+string literal whole thing identifier -> "pk_...."
// <--- intensive checks on $_post[nome_arquivo_software] , $_post[nome_arquivo_software] here $result = pg_query(" create table \"$_post[nome_arquivo_software]\" ( id serial constraint \"pk_$_post[nome_arquivo_software]\" primary key, nome varchar (80), email varchar (80), estado varchar (80), acessos numeric ) ");
Comments
Post a Comment