pg.ddx.io  pgsql-php@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Jason <gee308@mediaone.net>
To: Adam Lang <aalang@rutgersinsurance.com>
Cc: pgsql-php@postgresql.org
Subject: 2 more questions(Was: Re: psql with PHP question)
Date: Thu, 03 May 2001 10:06:10 -0400
Message-ID: <3AF165D1.D9F6420E@mediaone.net> (raw)
References: <3AF1427C.B4E85A45@is3-design.com>
	<3AF149C1.AEC30AA9@mediaone.net>
	<008b01c0d3d1$bfe11a00$330a0a0a@rutgersinsurance.com>

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");

?>




view thread (2+ messages)  latest in thread

Message-ID: <3AF165D1.D9F6420E@mediaone.net>
Permalink:  ../3AF165D1.D9F6420E@mediaone.net/
Also on:    postgresql.org/message-id/3AF165D1.D9F6420E@mediaone.net

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-php@postgresql.org
  Cc: gee308@mediaone.net, aalang@rutgersinsurance.com
  Subject: Re: 2 more questions(Was: Re: psql with PHP question)
  In-Reply-To: <3AF165D1.D9F6420E@mediaone.net>
  References: <3AF1427C.B4E85A45@is3-design.com> <3AF149C1.AEC30AA9@mediaone.net> <008b01c0d3d1$bfe11a00$330a0a0a@rutgersinsurance.com> <3AF165D1.D9F6420E@mediaone.net>

* 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