pg.ddx.io pgsql-interfaces@postgresql.org mailing list archive
help / color / mirror / Atom feed From: Constantin Teodorescu <teo@flex.ro>
To: Matthew T. O'Connor <matt@ctlno.com>
Cc: 'pgsql-interfaces@hub.org' <pgsql-interfaces@hub.org>
Subject: Re: [INTERFACES] Newbie needs help
Date: Fri, 29 May 1998 09:47:15 +0300
Message-ID: <356E59F3.321D38F2@flex.ro> (raw )
References: <D102A7979CACD111B97000A0C92376CA03195F@srv.ctlno.com >
Matthew T. O'Connor wrote:
>
> Any help? I have been reading about the pgsql module for Apache, but I
> can't find it. and I have been reading about PHP3 but I'm not sure how
> to use it.
<html>
<body bgcolor=white>
<?
Function Listeaza () {
global $res;
$nrecs=pg_NumRows($res);
$i=0;
echo "Clic <img src='/img/balls/bullet5.gif'> afiseaza si
modifica notita<br>";
echo "Clic <img src='/img/balls/bullet6.gif'> sterge <font
color=red><b>iremediabil</b></font> notita<br><br>";
echo "<table width=100%><tr
bgcolor=cyan><th> <th>Data<th>Subiect<th> </tr>";
while($i<$nrecs) {
echo "<tr><td align=center><a
href='blocnotes.php3?show+ovar=", pg_Result($res,$i,"oid"), "'>";
echo "<img src='/img/balls/bullet5.gif' border=0></a>";
echo
"<td>",substr(pg_Result($res,$i,"data"),0,16),"<td>",pg_Result($res,$i,"subiect");
echo "<td align=center><a
href='blocnotes.php3?delete+oid=",pg_Result($res,$i,"oid"),"'>";
echo "<img src='/img/balls/bullet6.gif'
border=0></a></tr>";
$i++;
}
echo "</table><br><br>";
}
?>
<? if ($argc==0): ?>
<? elseif ($argv[0]=="add"): ?>
<center>
<form name="nou" method=POST action="blocnotes.php3?store">
<table border=0><tr>
<td>Titlu: <input type="text" name="subiect" size=50></td></tr>
<tr><td><textarea name="continut" wrap="hard" rows=9
cols=60></textarea></td></tr>
<tr><td align="CENTER"><input type="submit" name="okbtn"
value="Adauga"></td></tr>
</table></form></center>
<? elseif ($argv[0]=="store"):
$acum=date("d-m-Y H:i:s");
echo "<font color=navy><b>Titlu</b></font> : $subiect<br><br>";
echo "<font color=maroon><b>Continut</b></font> :
$continut<br><br>";
$dbc=pg_Connect("localhost","5432","","","consiliu");
$res=pg_Exec($dbc,"insert into blocnotes
values('$REMOTE_USER','$acum','$subiect','$continut')");
pg_FreeResult($res);
pg_Close($dbc);
echo "A fost introdus in blocnotes!";
elseif ($argv[0]=="list"):
$dbc=pg_Connect("localhost","5432","","","consiliu");
$res=pg_Exec($dbc,"select oid,* from blocnotes where
iuzar='$REMOTE_USER' order by data desc");
Listeaza();
pg_FreeResult($res);
pg_Close($dbc);
elseif ($argv[0]=="show"):
$dbc=pg_Connect("localhost","5432","","","consiliu");
$res=pg_Exec($dbc,"select * from blocnotes where oid=$ovar");
echo "<font color=navy><b>Subiect :
</b></font>",pg_Result($res,0,"subiect"),"<br><br>";
echo "<font color=navy><b>Continut
:</b></font><br><pre>",pg_Result($res,0,"continut"),"</pre>";
echo "<br><br><br>";
echo "<a
href='blocnotes.php3?showandchange+ovar=$ovar'>Modifica</a><br>";
pg_FreeResult($res);
pg_close($dbc);
elseif ($argv[0]=="showandchange"):
$dbc=pg_Connect("localhost","5432","","","consiliu");
$res=pg_Exec($dbc,"select * from blocnotes where oid=$ovar");
?>
<center>
<form name="nou" method=POST
action="blocnotes.php3?modify+ovar=<? echo $ovar;?>">
<table border=0>
<tr><td>Titlu: <input type="text" name="subiect" size=50
value="<? echo pg_Result($res,0,"subiect"); ?>"></td></tr>
<tr><td><textarea name="continut" wrap="hard" rows=9 cols=60><?
echo pg_Result($res,0,"continut"); ?></textarea></td></tr>
<tr><td align="CENTER"><input type="submit" name="okbtn"
value="Modifica">
<input type="button" value="Abandon"
onClick="history.back()"></td></tr>
</table>
</form></center>
<?
pg_FreeResult($res);
pg_close($dbc);
elseif ($argv[0]=="modify"):
$dbc=pg_Connect("localhost","5432","","","consiliu");
$res=pg_Exec($dbc,"update blocnotes set
subiect='$subiect',continut='$continut' where oid=$ovar");
pg_FreeResult($res);
pg_Close($dbc);
echo "Am modificat, noile informatii sint :<br><br>";
echo "<font color=navy>Subiect :
</font><b>$subiect</b><br><br>";
echo "<font color=navy>Continut : </font><pre>$continut</pre>";
elseif ($argv[0]=="delete"):
$dbc=pg_Connect("localhost","5432","","","consiliu");
$res=pg_Exec($dbc,"delete from blocnotes where oid=$oid");
pg_FreeResult($res);
$res=pg_Exec($dbc,"select oid,* from blocnotes where
iuzar='$REMOTE_USER' order by data");
Listeaza();
pg_FreeResult($res);
pg_Close($dbc);
elseif ($argv[0]=="search"): ?>
<center>
<form name="caut" method=POST action="blocnotes.php3?find">
<table border=0>
<tr><td>Cuvint <input type="text" name="wort"></td></tr>
<tr><td align="CENTER"><input type="submit" name="okbtn"
value="Cauta"></td></tr>
</table></form></center>
<? elseif ($argv[0]=="find"):
if ($wort !="") {
$dbc=pg_Connect("localhost","5432","","","consiliu");
$res=pg_Exec($dbc,"select oid,* from blocnotes where
subiect ~* '$wort' or continut ~* '$wort'");
$nrecs=pg_NumRows($res);
if($nrecs==0) {
echo "Nu am gasit nimic!<br><br>";
} else {
Listeaza();
}
pg_FreeResult($res);
pg_Close($dbc);
}
else {
echo "<center><h1>Introduceti macar o litera
!</h1></center>";
}
endif;
?>
</body>
</html>
--
Constantin Teodorescu
FLEX Consulting Braila, ROMANIA
view thread (2+ messages)
Message-ID: <356E59F3.321D38F2@flex.ro>
Permalink: ../356E59F3.321D38F2@flex.ro/
Also on: postgresql.org/message-id/356E59F3.321D38F2@flex.ro
copy link · copy postgr.es
reply Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-interfaces@postgresql.org
Cc: teo@flex.ro, matt@ctlno.com, pgsql-interfaces@hub.org
Subject: Re: [INTERFACES] Newbie needs help
In-Reply-To: <356E59F3.321D38F2@flex.ro>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
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