unable to connect to datadase....

This is a multipart mime message


--Next_1142922268---0-203.199.83.246-7692
Content-type: text/plain;
charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

=0Ahi...=0A I am doin my project in PHP with PostgreSQL as backend...=
=0A Both r very new to me....=0AMy OS is LINUX =0A I am trying to=
connect to the database bt its not getin connected...=0A By using=0A =
"su postgres" command=0A i hav created user "root" and database "sample"=
=0A By using=0A "psql -U root sample" command=0A i hav created =
table "login" and inserted 3 data's...=0A Now through code using PHP i am=
trying to insert the data but connection is not getin established.. =0A=
the code to connect to the datadase is :-=0A =0A<?php=0A require_onc=
e "DB.php";=0A $uname=3D$_POST['uname'];=0A $pass=3D$_POST['pass'];=0A=
=0A$username=3D"root";=0A$password=3D"";=0A$hostname=3D"loca lhost";=0A$dbna=
me=3D"sample";=0A=0A$db=3Dnew DB;=0A$dsource=3D$db->factory("pgsql");=0A=0A=
$dcon=3Dpg_connect("dbname=3Dsample user=3Dmanashi");=0A=0A$sql=3D"insert i=
nto login values('$uname','$pass')";=0A=0A$rs=3D$dsource->pg_query($sq l);=
=0A?>=0A=0A is there anythin wrong with tthe code or sum other problem=0A =
waiting for the reply...
--Next_1142922268---0-203.199.83.246-7692
Content-type: text/html;
charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

<P>=0A  <BR>=0Ahi...<BR>=0A    I am doin my project in PHP w=
ith PostgreSQL as backend...<BR>=0A        Both r very=
new to me....<BR>=0AMy OS is LINUX  <BR>=0A I am trying to connect t=
o the database bt its not getin connected...<BR>=0A  By using<BR>=0A&n=
bsp;   "su postgres" command<BR>=0A  i hav created us=
er "root" and database "sample"<BR>=0A    By =
using<BR>=0A    "psql -U root sample" command<BR>=0A&n=
bsp;     i hav created table "login" and inserted 3 dat=
a's...<BR>=0A  Now through code using PHP i am trying to insert the d=
ata but  connection is not getin established..  <BR>=0A  t=
he code to connect to the datadase is :-<BR>=0A  <BR>=0A<?php<BR>=
=0A  require_once "DB.php";<BR>=0A  $uname=3D$_POST['=
uname'];<BR>=0A  $pass=3D$_POST['pass'];<BR>=0A<BR>=0A$username=3D&qu=
ot;root";<BR>=0A$password=3D"";<BR>=0A$hostname=3D"loca=
lhost";<BR>=0A$dbname=3D"sample";<BR>=0A<BR>=0A$db=3Dnew DB;=
<BR>=0A$dsource=3D$db->factory("pgsql");<BR>=0A<BR>=0A$dcon=3D=
pg_connect("dbname=3Dsample user=3Dmanashi");<BR>=0A<BR>=0A$sql=
=3D"insert into login values('$uname','$pass')";<BR>=0A<BR>=0A$rs=
=3D$dsource->pg_query($sql);<BR>=0A?><BR>=0A<BR>=0A  is there an=
ythin wrong with tthe code or sum other problem<BR>=0A    waiting=
for the reply... =0A</P>=0A<br><br>=0A<a href=3D"http://adworks.rediff.com=
/cgi-bin/AdWorks/sigclick.cgi/www.rediff.com/signature-home. htm/1507191490 [at] =
Middle5?PARTNER=3D3"><IMG SRC=3D"http://adworks.rediff.com/cgi-bin/AdWorks/=
sigimpress.cgi/www.rediff.com/signature-home.htm/1963059423 [at] Middle5?OAS_que=
ry=3Dnull&PARTNER=3D3" BORDER=3D0 VSPACE=3D0 HSPACE=3D0></a>=0A
--Next_1142922268---0-203.199.83.246-7692--
manashi chakraborty [ Di, 21 März 2006 07:24 ] [ ID #1239081 ]

Re: unable to connect to datadase....

manashi chakraborty wrote:
>
> hi...
> I am doin my project in PHP with PostgreSQL as backend...
> Both r very new to me....
> My OS is LINUX
> I am trying to connect to the database bt its not getin connected...
> By using
> "su postgres" command
> i hav created user "root" and database "sample"
> By using
> "psql -U root sample" command
> i hav created table "login" and inserted 3 data's...
> Now through code using PHP i am trying to insert the data but
> connection is not getin established..
> the code to connect to the datadase is :-
>
> <?php
> require_once "DB.php";
> $uname=$_POST['uname'];
> $pass=$_POST['pass'];
>
> $username="root";
> $password="";
> $hostname="localhost";
> $dbname="sample";
>
> $db=new DB;
> $dsource=$db->factory("pgsql");
>
> $dcon=pg_connect("dbname=sample user=manashi");


Add this after the pg_connect line:

echo pg_last_error();

what does that say?

Also change your mail program to send TEXT emails.

--
Postgresql & php tutorials
http://www.designmagick.com/

---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo [at] postgresql.org so that your
message can get through to the mailing list cleanly
Chris [ Di, 21 März 2006 07:44 ] [ ID #1239082 ]
Datenbanken » gmane.comp.db.postgresql.php » unable to connect to datadase....

Vorheriges Thema: [Fwd: Re: unable to connect to datadase....]
Nächstes Thema: total number of processor for windows