pg.ddx.io pgsql-php@postgresql.org mailing list archive
help / color / mirror / Atom feedentrance from php to postgresql
9+ messages / 2 participants
[nested] [flat]
* entrance from php to postgresql
@ 2006-07-11 14:39 DCarrero <dcarreroc@gmail.com>
0 siblings, 1 reply; 9+ messages in thread
From: DCarrero @ 2006-07-11 14:39 UTC (permalink / raw)
To: pgsql-php
Hi, i'm new here. my question is: Which is the best way to make an
entrance from php to postgresql?
I read in a manual call "PHP and Postgresql" writed for Vikram
Vaswani, he mentioned that is useful to do it:
http://www.devshed.com/c/a/PHP/PHP-and-PostgreSQL/5/
Please i need help ....
recommend this?
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: entrance from php to postgresql
@ 2006-07-11 15:34 John DeSoi <desoi@pgedit.com>
parent: DCarrero <dcarreroc@gmail.com>
0 siblings, 1 reply; 9+ messages in thread
From: John DeSoi @ 2006-07-11 15:34 UTC (permalink / raw)
To: DCarrero <dcarreroc@gmail.com>; +Cc: pgsql-php
On Jul 11, 2006, at 10:39 AM, DCarrero wrote:
> Hi, i'm new here. my question is: Which is the best way to make an
> entrance from php to postgresql?
> I read in a manual call "PHP and Postgresql" writed for Vikram
> Vaswani, he mentioned that is useful to do it:
> http://www.devshed.com/c/a/PHP/PHP-and-PostgreSQL/5/
> Please i need help ....
> recommend this?
I'm not sure if you are asking about tools/software or just general
information about how to connect PHP and PostgreSQL. The PHP
documentation is here:
http://www.php.net/manual/en/ref.pgsql.php
This book might be helpful to you:
http://www.amazon.com/gp/product/1590595475/103-7344715-4732658?
v=glance&n=283155
If you need software and are using Mac or Windows, pgEdit supports
PHP and PostgreSQL (http://pgedit.com/products). PHP is built-in so
you don't have to install anything else to connect to a PostgreSQL
database.
John DeSoi, Ph.D.
http://pgedit.com/
Power Tools for PostgreSQL
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: entrance from php to postgresql
@ 2006-07-11 17:23 DCarrero <dcarreroc@gmail.com>
parent: John DeSoi <desoi@pgedit.com>
0 siblings, 1 reply; 9+ messages in thread
From: DCarrero @ 2006-07-11 17:23 UTC (permalink / raw)
To: John DeSoi <desoi@pgedit.com>; +Cc: pgsql-php
2006/7/11, John DeSoi <desoi@pgedit.com>:
>
> On Jul 11, 2006, at 10:39 AM, DCarrero wrote:
>
> > Hi, i'm new here. my question is: Which is the best way to make an
> > entrance from php to postgresql?
> > I read in a manual call "PHP and Postgresql" writed for Vikram
> > Vaswani, he mentioned that is useful to do it:
> > http://www.devshed.com/c/a/PHP/PHP-and-PostgreSQL/5/
> > Please i need help ....
> > recommend this?
>
> I'm not sure if you are asking about tools/software or just general
> information about how to connect PHP and PostgreSQL. The PHP
> documentation is here:
>
> http://www.php.net/manual/en/ref.pgsql.php
>
> This book might be helpful to you:
>
> http://www.amazon.com/gp/product/1590595475/103-7344715-4732658?
> v=glance&n=283155
>
>
> If you need software and are using Mac or Windows, pgEdit supports
> PHP and PostgreSQL (http://pgedit.com/products). PHP is built-in so
> you don't have to install anything else to connect to a PostgreSQL
> database.
>
>
> John DeSoi, Ph.D.
> http://pgedit.com/
> Power Tools for PostgreSQL
>
>
I was asking if this useful, or secure to do a transaction on web, or
you recomend use a function with parameters an inside this insert
data, thank for the information too...
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: entrance from php to postgresql
@ 2006-07-11 17:44 John DeSoi <desoi@pgedit.com>
parent: DCarrero <dcarreroc@gmail.com>
0 siblings, 1 reply; 9+ messages in thread
From: John DeSoi @ 2006-07-11 17:44 UTC (permalink / raw)
To: DCarrero <dcarreroc@gmail.com>; +Cc: pgsql-php
On Jul 11, 2006, at 1:23 PM, DCarrero wrote:
> I was asking if this useful, or secure to do a transaction on web, or
> you recomend use a function with parameters an inside this insert
> data, thank for the information too...
If you are inserting user entered data (especially from the web) I
highly recommend you use prepared statements. This will deal with
security issues related to SQL injection. I prefer to use functions,
but it is not necessary. Here is a short article I wrote which you
might find helpful in using prepared statements from PHP:
http://pgedit.com/resource/php/pgfuncall
John DeSoi, Ph.D.
http://pgedit.com/
Power Tools for PostgreSQL
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: entrance from php to postgresql
@ 2006-07-11 17:49 DCarrero <dcarreroc@gmail.com>
parent: John DeSoi <desoi@pgedit.com>
0 siblings, 1 reply; 9+ messages in thread
From: DCarrero @ 2006-07-11 17:49 UTC (permalink / raw)
To: John DeSoi <desoi@pgedit.com>; +Cc: pgsql-php
2006/7/11, John DeSoi <desoi@pgedit.com>:
>
> On Jul 11, 2006, at 1:23 PM, DCarrero wrote:
>
> > I was asking if this useful, or secure to do a transaction on web, or
> > you recomend use a function with parameters an inside this insert
> > data, thank for the information too...
>
> If you are inserting user entered data (especially from the web) I
> highly recommend you use prepared statements. This will deal with
> security issues related to SQL injection. I prefer to use functions,
> but it is not necessary. Here is a short article I wrote which you
> might find helpful in using prepared statements from PHP:
>
> http://pgedit.com/resource/php/pgfuncall
Thanks again :D
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: entrance from php to postgresql
@ 2006-07-11 20:50 DCarrero <dcarreroc@gmail.com>
parent: DCarrero <dcarreroc@gmail.com>
0 siblings, 1 reply; 9+ messages in thread
From: DCarrero @ 2006-07-11 20:50 UTC (permalink / raw)
To: John DeSoi <desoi@pgedit.com>; +Cc: pgsql-php
Hi again...
I'm confused
I have this table:
CREATE TABLE jugeninno
(
nrt_nino rut NOT NULL,
dgv_ninno char(1),
nom_ninno varchar(50),
ape_ninno varchar(50),
num_mesna int4,
num_annon int4,
gls_sexo char(1),
nrt_adult varchar(10),
dgv_adult char(1),
nom_adult varchar(50),
gls_domic varchar(50),
num_orgso int4,
flg_inclu char(1),
CONSTRAINT jugeninno_pkey PRIMARY KEY (nrt_nino)
)
Then in php a query like this???
$query="PREPARE agregar_data(varchar(10), char(1), varchar(50),
varchar(50), int4, int4, char(1), varchar(10), char(1),
varchar(50), varchar(50), int4, char(1)) AS
INSERT INTO jugeninno(nrt_nino, dgv_ninno, nom_ninno, ape_ninno,
num_mesna, num_annon, gls_sexo,
nrt_adult, dgv_adult, nom_adult, gls_domic, num_orgso, flg_inclu)
VALUES($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13);"
take the post variables and execute with pg_execute()
pg_execute ($conn1,"select
agregar_data($rutninno,$dgvninno,$nomninno,$apeninno,
$nummesna,$numannona,$glssexo,$nrtadult,$dgvadult,$nomadult,$glsdomic,
$numorgsoc,$flginclu);");
This is ok???
After what????
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: entrance from php to postgresql
@ 2006-07-11 21:38 DCarrero <dcarreroc@gmail.com>
parent: DCarrero <dcarreroc@gmail.com>
0 siblings, 1 reply; 9+ messages in thread
From: DCarrero @ 2006-07-11 21:38 UTC (permalink / raw)
To: John DeSoi <desoi@pgedit.com>; +Cc: pgsql-php
2006/7/11, DCarrero <dcarreroc@gmail.com>:
> Hi again...
> I'm confused
> I have this table:
> CREATE TABLE jugeninno
> (
> nrt_nino rut NOT NULL,
> dgv_ninno char(1),
> nom_ninno varchar(50),
> ape_ninno varchar(50),
> num_mesna int4,
> num_annon int4,
> gls_sexo char(1),
> nrt_adult varchar(10),
> dgv_adult char(1),
> nom_adult varchar(50),
> gls_domic varchar(50),
> num_orgso int4,
> flg_inclu char(1),
> CONSTRAINT jugeninno_pkey PRIMARY KEY (nrt_nino)
> )
>
> Then in php a query like this???
> $query="PREPARE agregar_data(varchar(10), char(1), varchar(50),
> varchar(50), int4, int4, char(1), varchar(10), char(1),
> varchar(50), varchar(50), int4, char(1)) AS
> INSERT INTO jugeninno(nrt_nino, dgv_ninno, nom_ninno, ape_ninno,
> num_mesna, num_annon, gls_sexo,
> nrt_adult, dgv_adult, nom_adult, gls_domic, num_orgso, flg_inclu)
> VALUES($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13);"
>
> take the post variables and execute with pg_execute()
>
> pg_execute ($conn1,"select
> agregar_data($rutninno,$dgvninno,$nomninno,$apeninno,
> $nummesna,$numannona,$glssexo,$nrtadult,$dgvadult,$nomadult,$glsdomic,
> $numorgsoc,$flginclu);");
> This is ok???
> After what????
>
Is not better pg_prepare(); ???
and later pg_execute();
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: entrance from php to postgresql
@ 2006-07-12 00:06 John DeSoi <desoi@pgedit.com>
parent: DCarrero <dcarreroc@gmail.com>
0 siblings, 1 reply; 9+ messages in thread
From: John DeSoi @ 2006-07-12 00:06 UTC (permalink / raw)
To: DCarrero <dcarreroc@gmail.com>; +Cc: pgsql-php
On Jul 11, 2006, at 5:38 PM, DCarrero wrote:
> Is not better pg_prepare(); ???
> and later pg_execute();
Yes, this is the way to go.
John
John DeSoi, Ph.D.
http://pgedit.com/
Power Tools for PostgreSQL
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: entrance from php to postgresql
@ 2006-07-12 12:57 DCarrero <dcarreroc@gmail.com>
parent: John DeSoi <desoi@pgedit.com>
0 siblings, 0 replies; 9+ messages in thread
From: DCarrero @ 2006-07-12 12:57 UTC (permalink / raw)
To: John DeSoi <desoi@pgedit.com>; +Cc: pgsql-php
> Yes, this is the way to go.
>
> John
>
>
Thanks John, i'll learn :D
^ permalink raw reply [nested|flat] 9+ messages in thread
end of thread, other threads:[~2006-07-12 12:57 UTC | newest]
Thread overview: 9+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2006-07-11 14:39 entrance from php to postgresql DCarrero <dcarreroc@gmail.com>
2006-07-11 15:34 ` John DeSoi <desoi@pgedit.com>
2006-07-11 17:23 ` DCarrero <dcarreroc@gmail.com>
2006-07-11 17:44 ` John DeSoi <desoi@pgedit.com>
2006-07-11 17:49 ` DCarrero <dcarreroc@gmail.com>
2006-07-11 20:50 ` DCarrero <dcarreroc@gmail.com>
2006-07-11 21:38 ` DCarrero <dcarreroc@gmail.com>
2006-07-12 00:06 ` John DeSoi <desoi@pgedit.com>
2006-07-12 12:57 ` DCarrero <dcarreroc@gmail.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox