[phplib] BAsic Question - DB_pgsql.inc From: Peter Bowyer (reywob <email protected>)
Date: 09/20/00

Hi,

I've been trying to use the database modules of PHPLib in a script I'm
writing. However, I cannot get the next_record() function to work
properly. I'm using PosgreSQL as my database. The code in question is the
following (sorry about the size!):

=========================
include ("db_pgsql.inc");

$db = new DB_Sql;
$query = ("SELECT * FROM postcards where id=".$id);
$result = $db->query($query);

$card = $db->next_record($result);

$image = $card["image"];
$to = stripslashes($card["towho"]);
$to_email = $card["to_email"];
$from = stripslashes($card["fromwho"]);
$from_email = $card["from_email"];
$message = stripslashes($card["message"]);

  include("class.FastTemplate.php");
$tpl = new FastTemplate(".");

$tpl->define(array("message" => "message.tpl",
                    "card" => "card.tpl"));

$tpl->assign("IMAGE", $image);
$tpl->assign("TO", $to);
$tpl->assign("TO_EMAIL", $to_email);
$tpl->assign("FROM", $from);
$tpl->assign("FROM_EMAIL", $from_email);
$tpl->assign("MESSAGE", $message);
$tpl->assign("FOOTER", "You can send a card as well - replace with variable!");

$tpl->parse("CONTENT", ".message");

$tpl->parse("GLOBAL", "card");

$tpl->FastPrint();

mail ($from_email, $cardreceived_subject, $cardreceived, "From: $to_email");

$time = time();
$time -= $kept;

$clearout = ("DELETE FROM postcards where id < $time");
$db->query($clearout);
=================================

I'm pretty sure it's the next_record() function which isn't working, as I
am able to insert data using the query() function in another script. Is
there an error in the pgsql.inc file?

TIA,
Peter.
--oOo--
Narrow Gauge on the web - photos, directory and forums!
http://www.narrowgauge.f2s.com
--oOo--
Peter's web page - Scottish narrow gauge in 009
http://members.aol.com/reywob/
--oOo--

---------------------------------------------------------------------
To unsubscribe, e-mail: phplib-unsubscribe <email protected>
For additional commands, e-mail: phplib-help <email protected>