X-Original-To: pgsql-php-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 95C89D1B51A for ; Mon, 27 Oct 2003 09:01:11 +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 10760-03 for ; Mon, 27 Oct 2003 05:00:42 -0400 (AST) Received: from mailhub2.sghms.ac.uk (firewall.sghms.ac.uk [194.82.50.2]) by svr1.postgresql.org (Postfix) with ESMTP id 52C6AD1B4E1 for ; Mon, 27 Oct 2003 05:00:40 -0400 (AST) Received: from [194.82.51.24] (helo=imail) by mailhub2.sghms.ac.uk with esmtp (Exim 4.24) id 1AE3Et-0002gn-0d; Mon, 27 Oct 2003 09:00:39 +0000 Received: from [172.16.20.3] (mrc1-003.sghms.ac.uk [172.16.20.3]) by imail.sghms.ac.uk (iPlanet Messaging Server 5.1 HotFix 0.7 (built May 7 2002)) with ESMTPA id <0HNE00BO3RP21F@imail.sghms.ac.uk>; Mon, 27 Oct 2003 09:00:38 +0000 (GMT) Date: Mon, 27 Oct 2003 08:59:18 +0000 From: Adam Witney Subject: Re: array fields in the database and their handling with php4 In-reply-to: <20031026160449.7a72effa.Matthias.Weinhold@gmx.net> To: Matthias Weinhold , pgsql-php Message-id: MIME-version: 1.0 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT User-Agent: Microsoft-Entourage/10.1.1.2418 X-MailScanner-Information: Please contact sysadmin at sghms.ac.uk for more information X-MailScanner-MH2: Found to be clean X-MailScanner-SpamCheck: not spam, SpamAssassin (score=-4.4, required 5, APARENTLY_FROM_MYSELF 1.00, BAYES_00 -4.90, FROM_SGHMS -1.00, MY_NO_QU 0.50) X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200310/29 X-Sequence-Number: 2390 I'm not quite sure if this is what you are after, but if you are asking how to use a PostgreSQL array in php then it just comes in as a string, I then use this function to turn it into a php array function pg_array_php($array) { $new_array = explode(",", ereg_replace("[{-}]", "", $array)); return $new_array; } > Hey, > > i have a table 'mitarbeiter' in my database, column 'Abteilung' is an > array{'Abteilung1, Abteilung2'}, because some people work in more than > one section. Now i will print the results from a query like > > SELECT name, abteilung[1], abteilung[2],FROM mitarbeiter WHERE name = > D. Benner; > > to an html-table via php in this form: > > Name | Benner > ------------------- > Abteilung 1 | abt_1 > ------------------- > Abteilung 2 | abt_2 > > I don't no how to handle the array-field in the database? Any hints? > > Greetings from cold germany Matthias -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean.