How to create a new Table in prostgresql from a Webinterface
How to create a new Table in prostgresql from a Webinterface
am 14.08.2004 17:15:30 von Michelle Konzack
--RIYY1s2vRbPFwWeW
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
Hello,=20
Never I have done this before (no need) but now I nee to create a=20
new table with some colums from a Webinterface and do not know how=20
to do that.=20
Please can anyone point me into the right direction ?
Thanks, Greetings=20
and nice Weekend
Michelle
--=20
Linux-User #280138 with the Linux Counter, http://counter.li.org/=20
Michelle Konzack Apt. 917 ICQ #328449886
50, rue de Soultz MSM LinuxMichi
0033/3/88452356 67100 Strasbourg/France IRC #Debian (irc.icq.com)
--RIYY1s2vRbPFwWeW
Content-Type: application/pgp-signature; name="signature.pgp"
Content-Description: Digital signature
Content-Disposition: inline
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
iD8DBQFBHiyRC0FPBMSS+BIRAiGnAKCSMB909iCw7g0mugEK+1gGiEyPswCe OK0a
7QsopQ+zQvWWK7/ExDVkNfU=
=UO9t
-----END PGP SIGNATURE-----
--RIYY1s2vRbPFwWeW--
Re: How to create a new Table in prostgresql from a Webinterface
am 15.08.2004 00:55:34 von Raoul Buzziol
Michelle Konzack wrote:
> Hello,
>
> Never I have done this before (no need) but now I nee to create a
> new table with some colums from a Webinterface and do not know how
> to do that.
You have to execute a query:
pg_query(connection, "CREATE TABLE tablename (id serial, val int4...);");
>
> Please can anyone point me into the right direction ?
>
> Thanks, Greetings
> and nice Weekend
> Michelle
>
---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend
Re: How to create a new Table in prostgresql from a
am 15.08.2004 19:28:50 von Steve Bergman
--=-P7Ziq5bpi5UDBoDgZls0
Content-Type: text/plain
Content-Transfer-Encoding: 7bit
On Sat, 2004-08-14 at 17:15 +0200, Michelle Konzack wrote:
> Hello,
>
> Never I have done this before (no need) but now I nee to create a
> new table with some colums from a Webinterface and do not know how
> to do that.
>
> Please can anyone point me into the right direction ?
Are you looking for something like this? I just knocked this out, so
I'm sure ther are syntax errors and whatnot, but it should give you an
idea.
Oh, and are mime attachments considered OK on this list? If not, my
apologies.
-Steve
--=-P7Ziq5bpi5UDBoDgZls0
Content-Disposition: attachment; filename=create_table.php
Content-Type: application/x-php; name=create_table.php
Content-Transfer-Encoding: 7bit
// create_table.php
// Creates a table based on variables fieldname1, type1 and fieldname2, type2
$fieldname1 = $_POST['fieldname1'];
$type1 = $_POST['type1'];
$fieldname2 = $_POST['fieldname2'];
$type2 = $_POST['type2'];
$PGCON = pg_connect(dbname="mydb" user="me" password="mypassword");
$query_string = "DROP TABLE demo";
pg_query($PGCON,$query_string);
$query_string = <<
CREATE TABLE demo (
$fieldname1 $type1,
$fieldname2 $type2
)
EOT;
pg_query($PGCON,$query_string);
pg_close($PGCON);
?>
--=-P7Ziq5bpi5UDBoDgZls0
Content-Disposition: attachment; filename=webform.php
Content-Type: application/x-php; name=webform.php
Content-Transfer-Encoding: 7bit
// webform.php
// Web interface form
$pageStr = "";
$pageStr .= <<
EOT;
echo $pageStr;
?>
--=-P7Ziq5bpi5UDBoDgZls0
Content-Type: text/plain
Content-Disposition: inline
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
--=-P7Ziq5bpi5UDBoDgZls0--
Re: How to create a new Table in prostgresql from a Webinterface
am 16.08.2004 19:11:28 von Michelle Konzack
--XOIedfhf+7KOe/yw
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
Am 2004-08-15 00:55:34, schrieb Raoul Buzziol:
> Michelle Konzack wrote:
>=20
> > Hello,
> >=20
> > Never I have done this before (no need) but now I nee to create a
> > new table with some colums from a Webinterface and do not know how
> > to do that.
>=20
> You have to execute a query:
>=20
> pg_query(connection, "CREATE TABLE tablename (id serial, val int4...);");
:-/
I was looking for a php-Command or somthing like this to create the=20
table but not thinking on a pg_query WHICH execute the command...
Greetings
Michelle
--=20
Linux-User #280138 with the Linux Counter, http://counter.li.org/=20
Michelle Konzack Apt. 917 ICQ #328449886
50, rue de Soultz MSM LinuxMichi
0033/3/88452356 67100 Strasbourg/France IRC #Debian (irc.icq.com)
--XOIedfhf+7KOe/yw
Content-Type: application/pgp-signature; name="signature.pgp"
Content-Description: Digital signature
Content-Disposition: inline
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
iD8DBQFBIOq/C0FPBMSS+BIRArUwAKC53+bu5VxJ/wTV0TvQTCOOc6xYIwCd F/dk
NxZiAtYnMrviQ0Xqdg46l7Y=
=ffLx
-----END PGP SIGNATURE-----
--XOIedfhf+7KOe/yw--
Re: How to create a new Table in prostgresql from a
am 16.08.2004 19:31:45 von Robby Russell
--=-IBGYk7IyAYoqU5p3VDjg
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable
On Mon, 2004-08-16 at 10:11, Michelle Konzack wrote:
> Am 2004-08-15 00:55:34, schrieb Raoul Buzziol:
> > Michelle Konzack wrote:
> >=20
> > > Hello,
> > >=20
> > > Never I have done this before (no need) but now I nee to create a
> > > new table with some colums from a Webinterface and do not know how
> > > to do that.
> >=20
> > You have to execute a query:
> >=20
> > pg_query(connection, "CREATE TABLE tablename (id serial, val int4...);"=
);
>=20
> :-/
>=20
> I was looking for a php-Command or somthing like this to create the=20
> table but not thinking on a pg_query WHICH execute the command...
>=20
Well, a CREATE TABLE is just another type of SQL Query that you can run.
It's not a 'command' exactly..just a query.
-Robby
--=20
/***************************************
* Robby Russell | Owner.Developer.Geek
* PLANET ARGON | www.planetargon.com
* Portland, OR | robby@planetargon.com
* 503.351.4730 | blog.planetargon.com
* PHP/PostgreSQL Hosting & Development
****************************************/
--=-IBGYk7IyAYoqU5p3VDjg
Content-Type: application/pgp-signature; name=signature.asc
Content-Description: This is a digitally signed message part
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (GNU/Linux)
iD8DBQBBIO+B0QaQZBaqXgwRAq6SAKDBBPumsZSF700SWcOB9Eca9NSZdQCg q6mI
9TqemdkAdFxh5M1+etzToRQ=
=U2JC
-----END PGP SIGNATURE-----
--=-IBGYk7IyAYoqU5p3VDjg--
Re: How to create a new Table in prostgresql from a Webinterface
am 16.08.2004 19:36:06 von pedro.borracha
On php.net, if you did a search for pg_ , you would have seen the PHP
Function List .....
pg_close pg_connect pg_convert pg_copy_to
pg_dbname pg_delete pg_get_pid pg_host
pg_insert pg_lo_open pg_lo_read pg_lo_seek
pg_ping pg_port pg_query pg_select
pg_trace pg_tty pg_update preg_grep
\\pb
Michelle Konzack wrote:
> Am 2004-08-15 00:55:34, schrieb Raoul Buzziol:
>
>>Michelle Konzack wrote:
>>
>>
>>>Hello,
>>>
>>>Never I have done this before (no need) but now I nee to create a
>>>new table with some colums from a Webinterface and do not know how
>>>to do that.
>>
>>You have to execute a query:
>>
>>pg_query(connection, "CREATE TABLE tablename (id serial, val int4...);");
>
>
> :-/
>
> I was looking for a php-Command or somthing like this to create the
> table but not thinking on a pg_query WHICH execute the command...
>
>
> Greetings
> Michelle
>
---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings
Re: How to create a new Table in prostgresql from a Webinterface
am 17.08.2004 02:41:17 von Todd Lewis
Just a followup question.
I'm fairly new to using PHP and pg. Security wise how could I limit a request such as
this? I'm assuming that if you have given a PHP user the ability to create tables, the
user also has the ability to truncate and delete tables as well.
> On php.net, if you did a search for pg_ , you would have seen the PHP
> Function List .....
>
> pg_close pg_connect pg_convert pg_copy_to
> pg_dbname pg_delete pg_get_pid pg_host
> pg_insert pg_lo_open pg_lo_read pg_lo_seek
> pg_ping pg_port pg_query pg_select
> pg_trace pg_tty pg_update preg_grep
>
>
> \\pb
>
> Michelle Konzack wrote:
> > Am 2004-08-15 00:55:34, schrieb Raoul Buzziol:
> >
> >>Michelle Konzack wrote:
> >>
> >>
> >>>Hello,
> >>>
> >>>Never I have done this before (no need) but now I nee to create a
> >>>new table with some colums from a Webinterface and do not know how
> >>>to do that.
> >>
> >>You have to execute a query:
> >>
> >>pg_query(connection, "CREATE TABLE tablename (id serial, val int4...);");
> >
> >
> > :-/
> >
> > I was looking for a php-Command or somthing like this to create the
> > table but not thinking on a pg_query WHICH execute the command...
> >
> >
> > Greetings
> > Michelle
> >
>
> ---------------------------(end of broadcast)---------------------------
> TIP 7: don't forget to increase your free space map settings
---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
Re: How to create a new Table in prostgresql from a Webinterface
am 17.08.2004 03:20:27 von Christopher Kings-Lynne
>>pg_query(connection, "CREATE TABLE tablename (id serial, val int4...);");
>
>
> :-/
>
> I was looking for a php-Command or somthing like this to create the
> table but not thinking on a pg_query WHICH execute the command...
There is no such command.
---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match
Re: How to create a new Table in prostgresql from a
am 02.10.2004 11:46:07 von Frank Finner
T24gTW9uLCAxNiBBdWcgMjAwNCAxOTo0MToxNyAtMDUwMCAiVG9kZCBMZXdp
cyIgPGxld2lzLXRvZGRAY29tY2FzdC5uZXQ+IHNhdA0KZG93biwgdGhvdWdo
dCBsb25nIGFuZCB0aGVuIHdyb3RlOg0KDQo+IEp1c3QgYSBmb2xsb3d1cCBx
dWVzdGlvbi4NCj4gDQo+IEknbSBmYWlybHkgbmV3IHRvIHVzaW5nIFBIUCBh
bmQgcGcuIFNlY3VyaXR5IHdpc2UgaG93IGNvdWxkIEkgbGltaXQgYSByZXF1
ZXN0DQo+IHN1Y2ggYXMgdGhpcz8gSSdtIGFzc3VtaW5nIHRoYXQgaWYgeW91
IGhhdmUgZ2l2ZW4gYSBQSFAgdXNlciB0aGUgYWJpbGl0eSB0bw0KPiBjcmVh
dGUgdGFibGVzLCB0aGUgdXNlciBhbHNvIGhhcyB0aGUgYWJpbGl0eSB0byB0
cnVuY2F0ZSBhbmQgZGVsZ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