From: | Marcus Krause <marcus(dot)k79(at)expires-2003-11-30(dot)arcornews(dot)de> |
---|---|
To: | pgsql-sql(at)postgresql(dot)org |
Subject: | No output while using PEAR DB & formatted time-string |
Date: | 2003-11-01 11:00:16 |
Message-ID: | bo03pg$1pva$1@news.hub.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
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 <<<HTML
$newsid_row->news_id<br> <!-- there's an output -->
$newsid_row->news_time<br> <!-- there's no output -->
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 | Date | Subject | |
---|---|---|---|
Next Message | Marcus Krause | 2003-11-01 12:05:53 | Re: No output while using PEAR DB & formatted time-string |
Previous Message | Tomasz Myrta | 2003-10-31 19:53:12 | Re: selecting problems |