X-Original-To: pgsql-php-postgresql.org@localhost.postgresql.org Received: from localhost (neptune.hub.org [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 26F6FD1B43A for ; Mon, 22 Dec 2003 10:47:34 +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 95438-01 for ; Mon, 22 Dec 2003 06:46:46 -0400 (AST) Received: from imail1.gazeta.pl (imail1.gazeta.pl [193.42.231.143]) by svr1.postgresql.org (Postfix) with ESMTP id AAF3ED1B477 for ; Mon, 22 Dec 2003 06:46:42 -0400 (AST) Received: from ew11 (unverified [172.20.26.241]) by (imail1.gazeta.pl) with ESMTP id 21161907 for multiple; Mon, 22 Dec 2003 11:46:38 +0300 Message-ID: <1072090005426.ew11.ripley@gazeta.pl> Date: Mon, 22 Dec 2003 11:46:45 +0100 (CET) From: To: "Ângelo Marcos Rigo" Subject: Re: Interactive querys Cc: pgsql-php@postgresql.org In-Reply-To: <20031215132314.74948.qmail@web14801.mail.yahoo.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-2 Content-Transfer-Encoding: 8bit X-mailer: (c)Agora mailer (v3.00) Organization: Portal Agory S.A. X-IP: dabrowskiego.demo.pl X-Complaints-To: abuse@gazeta.pl X-URL: http://www.gazeta.pl X-QuoteString: :-> X-Virus-Scanned: by amavisd-new at postgresql.org X-Amavis-Alert: BAD HEADER Non-encoded 8-bit data (char C2 hex) in message header 'To' To: "\302ngelo Marcos Ri... ^ X-Archive-Number: 200312/62 X-Sequence-Number: 2508 ------ Wiadomo¶æ oryginalna ------ Od: Ângelo Marcos Rigo Data: 2003-12-15 14:23 Temat: Re: [PHP] Interactive querys :-> Using two textareas side by side, with the query :-> options coming from the left? :-> :-> ===== :-> Ângelo Marcos Rigo --------------------------------------------- Hi Angelo It's possible to write it using only PHP 1. First - you have to put on the web-form all the fields, that user will use to customer his query - like: - checkboxes - whose correspond to columns, wich user want to put in a query - text fields - where user can enter the expression used to "where" condition - lists fields - which for egzample includes positions "asceding", "descending" - some "hidden" fields, that will provide some addtitional information to the script.php which will build the query - in the tag < form action="..." > use the method=post //I always name this fileds using full name of column + some keyword - it helps ;)// 2. Second - you have only to build your query string - using conditions "if..." : start with: $query_str = "select "; if ($_POST["id_chbox"] = 1) $query_str += $_POST["id_chbox"]; if ($_POST["name_chbox"] = 1) $query_str += ", ".$_POST["id_name"]; .............. and so on You can also try to make this script "universal" by using iterations through $_POST variables - its possible to write something like for ($n=0; n < ...;$n++) { $_POST[$cols[$n]."_chbox"]............ } The only minus of this method is that it can take some time :) I hope it helps Asia Sledzik //sory for readers for this additional enters beetween every, but my e-mail server put them all and I can't help for it// ------------ R E K L A M A ------------ Gotowy do drogi? Swiateczny Kalendarz SAS zaprasza! Przez 24 dni oferujemy 24 oferty specjalne do Europy i USA. Tylko na stronie http://www.scandinavian.net/ (wybierz Polske)