Skip site navigation (1) Skip section navigation (2)

Re: Interactive querys

From: <ripley(at)gazeta(dot)pl>
To: "ngelo Marcos Rigo" <angelo_rigo(at)yahoo(dot)com(dot)br>
Cc: pgsql-php(at)postgresql(dot)org
Subject: Re: Interactive querys
Date: 2003-12-22 10:46:45
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-php
------ Wiadomość oryginalna ------

Od:    Ângelo Marcos Rigo <angelo_rigo(at)yahoo(dot)com(dot)br>

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" 

 - lists fields - which for egzample includes positions "asceding", 

 - 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++)




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 (wybierz Polske)

In response to


pgsql-php by date

Next:From: ripleyDate: 2003-12-22 12:41:46
Subject: Re: Interactive querys
Previous:From: Marek LewczukDate: 2003-12-22 07:16:56
Subject: Re: sql_num_rows on win32

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group