From marcus.k79@expires-2003-11-30.arcornews.de Sat Nov 1 11:16:36 2003 X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 922B3D1B57D for ; Sat, 1 Nov 2003 11:16:36 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 10889-06 for ; Sat, 1 Nov 2003 07:16:08 -0400 (AST) Received: from news.hub.org (news.hub.org [200.46.204.72]) by svr1.postgresql.org (Postfix) with ESMTP id 10DB0D1B57C for ; Sat, 1 Nov 2003 07:16:06 -0400 (AST) Received: from news.hub.org (news.hub.org [200.46.204.72]) by news.hub.org (8.12.9/8.12.9) with ESMTP id hA1BG5Nu061138 for ; Sat, 1 Nov 2003 11:16:05 GMT (envelope-from news@news.hub.org) Received: (from news@localhost) by news.hub.org (8.12.9/8.12.9/Submit) id hA1B15Cv059425 for pgsql-sql@postgresql.org; Sat, 1 Nov 2003 11:01:05 GMT From: Marcus Krause X-Newsgroups: comp.databases.postgresql.sql Subject: No output while using PEAR DB & formatted time-string Date: Sat, 01 Nov 2003 12:00:16 +0100 Organization: Hub.Org Networking Services Lines: 31 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@news.hub.org User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; de-AT; rv:1.4) Gecko/20030624 X-Accept-Language: de-at, en-us, en, fr-fr X-Enigmail-Version: 0.76.4.0 X-Enigmail-Supports: pgp-inline, pgp-mime To: pgsql-sql@postgresql.org X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200311/51 X-Sequence-Number: 15866 I have a problem in using the to_char function in a SQL-Statement and addressing it with DB_FETCHMODE_OBJECT under PEAR DB. The follwing code is working fine unless I'm adding the to_char function: -------------------------------------------------------------- require_once 'DB.php'; $dsn = $$$; $db = DB::connect($dsn); $db->setFetchMode(DB_FETCHMODE_OBJECT); $query .= "SELECT news_id,to_char(news_time,'DD.MM.YYYY HH24:MI'), "; $query .= "FROM News "; $query .= "WHERE news_id=$var"; $sth = $db->query($query); while($newsid_row=$sth->fetchRow()) { print <<news_id
$newsid_row->news_time
blabla HTML; } $db->disconnect(); -------------------------------------------------------------- Has anybody an idea to get this working or similar experiences? Thanks for your patience; could be the wrong newsgroup!? From marcus.k79@expires-2003-11-30.arcornews.de Sat Nov 1 12:16:37 2003 X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 1C11FD1B587 for ; Sat, 1 Nov 2003 12:16:37 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 18714-06 for ; Sat, 1 Nov 2003 08:16:08 -0400 (AST) Received: from news.hub.org (news.hub.org [200.46.204.72]) by svr1.postgresql.org (Postfix) with ESMTP id 8010ED1B8B4 for ; Sat, 1 Nov 2003 08:16:05 -0400 (AST) Received: from news.hub.org (news.hub.org [200.46.204.72]) by news.hub.org (8.12.9/8.12.9) with ESMTP id hA1CG5Nu068507 for ; Sat, 1 Nov 2003 12:16:05 GMT (envelope-from news@news.hub.org) Received: (from news@localhost) by news.hub.org (8.12.9/8.12.9/Submit) id hA1C6gDn067296 for pgsql-sql@postgresql.org; Sat, 1 Nov 2003 12:06:42 GMT From: Marcus Krause X-Newsgroups: comp.databases.postgresql.sql Subject: Re: No output while using PEAR DB & formatted time-string Date: Sat, 01 Nov 2003 13:05:53 +0100 Organization: Hub.Org Networking Services Lines: 7 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@news.hub.org User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; de-AT; rv:1.4) Gecko/20030624 X-Accept-Language: de-at, en-us, en, fr-fr In-Reply-To: X-Enigmail-Version: 0.76.4.0 X-Enigmail-Supports: pgp-inline, pgp-mime To: pgsql-sql@postgresql.org X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200311/54 X-Sequence-Number: 15869 Am 01.11.2003 12:00 meinte Marcus Krause: > $query .= "SELECT news_id,to_char(news_time,'DD.MM.YYYY HH24:MI'), "; The real code is without the comma at the end of the line above, so it's not a simple SQL-Statement problem!