X-Original-To: pgsql-php-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 39A6953A10 for ; Fri, 13 May 2005 08:58:56 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 19267-08 for ; Fri, 13 May 2005 11:58:47 +0000 (GMT) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.192]) by svr1.postgresql.org (Postfix) with ESMTP id 2F70F539FD for ; Fri, 13 May 2005 08:58:46 -0300 (ADT) Received: by wproxy.gmail.com with SMTP id 68so1157562wri for ; Fri, 13 May 2005 04:58:50 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=HrwLfQT9/C0JymGM1LMRA30WRKLgcxErF0m1OorYBFUg48dLgZblWwTYfy7yhY6anrSnNNNYBvbuHP/Da8E9+WeJ8Y1XyKsvbnWKIgPkw2qlCSqg+EgtOKA51Oyx8a25Fv+QxR3fP0m8qjwMLMj91NFZqAdNqQqAq2w93Zp3j44= Received: by 10.54.24.31 with SMTP id 31mr1779199wrx; Fri, 13 May 2005 04:58:50 -0700 (PDT) Received: by 10.54.30.45 with HTTP; Fri, 13 May 2005 04:58:50 -0700 (PDT) Message-ID: <7104a73705051304583d38f3ee@mail.gmail.com> Date: Fri, 13 May 2005 14:58:50 +0300 From: Volkan YAZICI Reply-To: Volkan YAZICI To: SG Edwards Subject: Re: Printing off the page.... Cc: pgsql-php@postgresql.org In-Reply-To: <1115978112.428479801cb7b@sms.ed.ac.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <1115978112.428479801cb7b@sms.ed.ac.uk> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.326 tagged_above=0 required=5 tests=AWL, DNS_FROM_RFC_ABUSE, RCVD_BY_IP X-Spam-Level: X-Archive-Number: 200505/26 X-Sequence-Number: 3140 Hi, On 5/13/05, SG Edwards wrote: > I have a postgres database connected to a website using PHP. > I have a table that stores gene sequences which are very long (approx. 80= 0 > characters). >=20 > If I try and print this, it prints as a single line which runs off the pa= ge. Is > there a way to print the sequence with a line break every 50 characters? >=20 > for example, >=20 > AAAAAAAAAAAACCCCCCCCCCC > TTTTTTTTTTTTTTTTGGGGGGG > AAAAAAAAATTT >=20 > Rather than: > AAAAAAAAAAACCCCCCCCCCCCTTTTTTTTTTTTTGGGGGGGGGGGAAAAAAAAAATTT You can write a simple wrap function for it. For example: function wrapAndPrint($text, $maxLineLen =3D 50) { // We don't need to make a strlen() call everytime. $lineLen =3D strlen($text); =20 for ( $i =3D 0; $i < $lineLen; $i++ ) print $text[$i].(( $i % $maxLineLen =3D=3D 0 ) ? '\n' : ''); } And then you can call wrapAndPrint() function everytime, when you need to print fetched rows from the query result. (Also it's possible to write a PL/WHATEVER function for it too.) Regards.