pg.ddx.io pgsql-php@postgresql.org mailing list archive
help / color / mirror / Atom feed2 more questions(Was: Re: psql with PHP question)
2+ messages / 2 participants
[nested] [flat]
* 2 more questions(Was: Re: psql with PHP question)
@ 2001-05-03 14:06 Jason <gee308@mediaone.net>
2001-05-03 14:28 ` Re: 2 more questions(Was: Re: psql with PHP question) Adam Lang <aalang@rutgersinsurance.com>
0 siblings, 1 reply; 2+ messages in thread
From: Jason @ 2001-05-03 14:06 UTC (permalink / raw)
To: Adam Lang <aalang@rutgersinsurance.com>; +Cc: pgsql-php
Thanks for the help, sorry for cross posting.
I have 2 more questions. I am a newb with psql and PHP. I am creating a
slashdot like site. First, what is the best way to store an article? Inside
psql or just reference the path inside psql or is there another method? I am
currently using the path inside psql then use readfile() from PHP to display
the file. Second, Can you guys with experience tell me where I am writing
code improperly or give some tips? This short code segment just displays the
article and comments posted with it. Thanks:
<?
include("./phpinc/psql.php");
include("./phpinc/func.php");
include("./phpinc/var.php");
include("/usr/local/apache/phpinc/variables");
include("/usr/local/apache/phpinc/header");
if (!$conn)
echo "Site is temporarily down";
else {
if(isset($sid)){
$q1 = pg_Exec($conn,"select author,title,path,description from article
where sid=$sid");
$arr = pg_fetch_array($q1, 0);
echo "By ". $arr["author"] .": ". $arr["title"] ."<br>";
echo $arr["description"] ."<br><br><br>";
echo $arr["path"]."<br>"; //this line is just for seign if the path is set
correctly
readfile($arr["path"]);
// echo $arr["path"];
//next 3 lines are jut for replying to the article
echo "<table width=100% bgcolor=$table1><tr><td align=right><form
action=submit.php?sid=$sid method=post>";
echo "<input type=submit value=Post></tr></td></table>";
echo "<BR><BR><BR><BR>";
//start the comments section here
$q3 = pg_Exec($conn, "select cid from comment where article='$sid'");
$maxid = pg_numrows($q3);
$q2 = pg_Exec($conn,"select uname,time,date,post,ctitle,cid from comment
where
article=$sid");
if(!empty($maxid)){
for($i=0;$i<$maxid;$i++){
$arr2 = pg_fetch_array($q2, $i);
echo "By ". $arr2["uname"] .": ". $arr2["ctitle"] ."<br>";
echo $arr2["post"] ."<br>";
echo "<a href=./submit.php?sid=$sid&cid=". $arr2["cid"] .">Reply to
this</a><br><br>";
}
}
}
}
include("/usr/local/apache/phpinc/footer");
?>
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: 2 more questions(Was: Re: psql with PHP question)
2001-05-03 14:06 2 more questions(Was: Re: psql with PHP question) Jason <gee308@mediaone.net>
@ 2001-05-03 14:28 ` Adam Lang <aalang@rutgersinsurance.com>
0 siblings, 0 replies; 2+ messages in thread
From: Adam Lang @ 2001-05-03 14:28 UTC (permalink / raw)
To: ; +Cc: pgsql-php
If they are just text files, run the most current version of Postgres and
store the text in the database. The TOAST support for text is supposed to
be excellent.
Adam Lang
Systems Engineer
Rutgers Casualty Insurance Company
http://www.rutgersinsurance.com
----- Original Message -----
From: "Jason" <gee308@mediaone.net>
To: "Adam Lang" <aalang@rutgersinsurance.com>
Cc: <pgsql-php@postgresql.org>
Sent: Thursday, May 03, 2001 10:06 AM
Subject: 2 more questions(Was: Re: [PHP] psql with PHP question)
> Thanks for the help, sorry for cross posting.
> I have 2 more questions. I am a newb with psql and PHP. I am creating a
> slashdot like site. First, what is the best way to store an article?
Inside
> psql or just reference the path inside psql or is there another method? I
am
> currently using the path inside psql then use readfile() from PHP to
display
> the file. Second, Can you guys with experience tell me where I am writing
> code improperly or give some tips? This short code segment just displays
the
> article and comments posted with it. Thanks:
>
>
> <?
> include("./phpinc/psql.php");
> include("./phpinc/func.php");
> include("./phpinc/var.php");
> include("/usr/local/apache/phpinc/variables");
> include("/usr/local/apache/phpinc/header");
>
>
> if (!$conn)
> echo "Site is temporarily down";
>
> else {
> if(isset($sid)){
> $q1 = pg_Exec($conn,"select author,title,path,description from article
> where sid=$sid");
> $arr = pg_fetch_array($q1, 0);
> echo "By ". $arr["author"] .": ". $arr["title"] ."<br>";
> echo $arr["description"] ."<br><br><br>";
> echo $arr["path"]."<br>"; //this line is just for seign if the path is
set
> correctly
> readfile($arr["path"]);
> // echo $arr["path"];
>
> //next 3 lines are jut for replying to the article
> echo "<table width=100% bgcolor=$table1><tr><td align=right><form
> action=submit.php?sid=$sid method=post>";
> echo "<input type=submit value=Post></tr></td></table>";
> echo "<BR><BR><BR><BR>";
>
>
> //start the comments section here
> $q3 = pg_Exec($conn, "select cid from comment where article='$sid'");
> $maxid = pg_numrows($q3);
> $q2 = pg_Exec($conn,"select uname,time,date,post,ctitle,cid from comment
> where
> article=$sid");
> if(!empty($maxid)){
> for($i=0;$i<$maxid;$i++){
> $arr2 = pg_fetch_array($q2, $i);
> echo "By ". $arr2["uname"] .": ". $arr2["ctitle"] ."<br>";
> echo $arr2["post"] ."<br>";
> echo "<a href=./submit.php?sid=$sid&cid=". $arr2["cid"] .">Reply
to
> this</a><br><br>";
> }
> }
> }
> }
> include("/usr/local/apache/phpinc/footer");
>
> ?>
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2001-05-03 14:28 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2001-05-03 14:06 2 more questions(Was: Re: psql with PHP question) Jason <gee308@mediaone.net>
2001-05-03 14:28 ` Adam Lang <aalang@rutgersinsurance.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