Re: 08P01: unexpected EOF on client connection

From: Jasen Betts <jasen(at)xnet(dot)co(dot)nz>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: 08P01: unexpected EOF on client connection
Date: 2009-05-02 12:48:18
Message-ID: gthfei$p86$1@reversiblemaps.ath.cx
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 2009-05-01, Tomas Vondra <tv(at)fuzzy(dot)cz> wrote:
> Hi,
>
> I've run into some strange troubles with a quite simple web application
> that stores data in a PostgreSQL database. It is a simple image gallery,
> displaying multiple thumbnails (stored in a bytea column) on a single
> page generated by PHP. The problem is some of the images are not displayed.
>
> $conn = pg_connect(...);
> $res = pg_query("SELECT mime, thumbnail_data FROM images WHERE filename
>= ....");
> $row = pg_fetch_assoc($row);
> header('Content-Type: ' . $row['mime']);
> echo pg_unescape_bytea($row['thumbnail_data']);

This is cut-n-paste from a working site (pg 7.4, PHP 4.3.9)

$res=pg_query("select * from images where id='$id' ;");
$row=pg_fetch_assoc($res);
header("content-type: $row[type]");
echo pg_unescape_bytea($row['data']);

the date on the file is NOV 19 2006.
wasn't I a crap programmer back then :)

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Thomas Pundt 2009-05-02 13:03:49 Re: How to begin to debug FATAL: invalid frontend message type 77 error messages?
Previous Message Alban Hertroys 2009-05-02 10:14:53 Re: Difference between array column type and separate table