pg.ddx.io  pgsql-php@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Interactive querys
6+ messages / 4 participants
[nested] [flat]

* Interactive querys
@ 2003-12-15 12:46 Ângelo Marcos Rigo <angelo_rigo@yahoo.com.br>
  2003-12-15 13:02 ` Re: Interactive querys Marek Lewczuk <newsy@lewczuk.com>
  0 siblings, 1 reply; 6+ messages in thread

From: Ângelo Marcos Rigo @ 2003-12-15 12:46 UTC (permalink / raw)
  To: pgsql-php

Hi 

I want to build an aplication to perform interactive
querys where the user can select the fields he want to
query and still reorder the query itens. 

This can be done only using php or javascript or flash
are needed?

Thanks in advance 

=====
Ângelo Marcos Rigo
AMR Informática 
(51) 3348 0870 
Rua Pe. Alois Kades 400/210 
Porto Alegre /RS/Brasil
http://amr.freezope.org
angelo_rigo@yahoo.com.br
 


______________________________________________________________________

Yahoo! Mail: 6MB, anti-spam e antivírus gratuito! Crie sua conta agora:
http://mail.yahoo.com.br



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: Interactive querys
  2003-12-15 12:46 Interactive querys Ângelo Marcos Rigo <angelo_rigo@yahoo.com.br>
@ 2003-12-15 13:02 ` Marek Lewczuk <newsy@lewczuk.com>
  2003-12-15 13:23   ` Re: Interactive querys Ângelo Marcos Rigo <angelo_rigo@yahoo.com.br>
  0 siblings, 1 reply; 6+ messages in thread

From: Marek Lewczuk @ 2003-12-15 13:02 UTC (permalink / raw)
  To: Ângelo Marcos Rigo <angelo_rigo@yahoo.com.br>; +Cc: pgsql-php

Ângelo Marcos Rigo wrote:
> Hi 
> 
> I want to build an aplication to perform interactive
> querys where the user can select the fields he want to
> query and still reorder the query itens. 
> 
> This can be done only using php or javascript or flash
> are needed?

It depends from your choice - for example you can use only PHP and 
fields names can be send by $_GET variables, e.g. Ofcourse it can be 
done with javascript - it will be more dynamic.

ML

 



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: Interactive querys
  2003-12-15 12:46 Interactive querys Ângelo Marcos Rigo <angelo_rigo@yahoo.com.br>
  2003-12-15 13:02 ` Re: Interactive querys Marek Lewczuk <newsy@lewczuk.com>
@ 2003-12-15 13:23   ` Ângelo Marcos Rigo <angelo_rigo@yahoo.com.br>
  2003-12-22 10:46     ` Re: Interactive querys ripley@gazeta.pl
  0 siblings, 1 reply; 6+ messages in thread

From: Ângelo Marcos Rigo @ 2003-12-15 13:23 UTC (permalink / raw)
  To: Marek Lewczuk <newsy@lewczuk.com>; +Cc: pgsql-php

Using two textareas side by side, with the query
options coming from the left?   

=====
Ângelo Marcos Rigo
AMR Informática 
(51) 3348 0870 
Rua Pe. Alois Kades 400/210 
Porto Alegre /RS/Brasil
http://amr.freezope.org
angelo_rigo@yahoo.com.br
 


______________________________________________________________________

Yahoo! Mail: 6MB, anti-spam e antivírus gratuito! Crie sua conta agora:
http://mail.yahoo.com.br



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: Interactive querys
  2003-12-15 12:46 Interactive querys Ângelo Marcos Rigo <angelo_rigo@yahoo.com.br>
  2003-12-15 13:02 ` Re: Interactive querys Marek Lewczuk <newsy@lewczuk.com>
  2003-12-15 13:23   ` Re: Interactive querys Ângelo Marcos Rigo <angelo_rigo@yahoo.com.br>
@ 2003-12-22 10:46     ` ripley@gazeta.pl
  2003-12-22 17:02       ` Re: Interactive querys Mariusz Pekala <skoot@qi.pl>
  0 siblings, 1 reply; 6+ messages in thread

From: ripley@gazeta.pl @ 2003-12-22 10:46 UTC (permalink / raw)
  To: Ângelo Marcos Rigo <angelo_rigo@yahoo.com.br>; +Cc: pgsql-php

------ Wiadomość oryginalna ------


Od:    Ângelo Marcos Rigo <angelo_rigo@yahoo.com.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" 
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)



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: Interactive querys
  2003-12-15 12:46 Interactive querys Ângelo Marcos Rigo <angelo_rigo@yahoo.com.br>
  2003-12-15 13:02 ` Re: Interactive querys Marek Lewczuk <newsy@lewczuk.com>
  2003-12-15 13:23   ` Re: Interactive querys Ângelo Marcos Rigo <angelo_rigo@yahoo.com.br>
  2003-12-22 10:46     ` Re: Interactive querys ripley@gazeta.pl
@ 2003-12-22 17:02       ` Mariusz Pekala <skoot@qi.pl>
  0 siblings, 0 replies; 6+ messages in thread

From: Mariusz Pekala @ 2003-12-22 17:02 UTC (permalink / raw)
  To: pgsql-php; +Cc: ripley@gazeta.pl

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

The idea is nice. I am using similiar technique in my work, but you commited 
some mistakes in the code. It may cause some anger/frustration amongst newbie 
ones. :-)

ripley@gazeta.pl (pon 22. grudzień 2003 11:46):
> ------ Wiadomość oryginalna ------
> Od:    Ângelo Marcos Rigo <angelo_rigo@yahoo.com.br>
> Data:  2003-12-15 14:23
>
> Temat: Re: [PHP] Interactive querys
[...]
> 2. Second - you have only to build your query string - using
> conditions "if..." :
>
> start with:
>
> $query_str = "select ";
>
> if ($_POST["id_chbox"] = 1)

It sets the value of possibly non-existing $_POST["id_chbox"] to 1, that 
expression is evaluated as TRUE, thus the following is always executed.

>      $query_str += $_POST["id_chbox"];

You, probably, wanted to say: $query_str .= ' id';

> if ($_POST["name_chbox"] = 1)
>        $query_str += ", ".$_POST["id_name"];

Same here... == instead of =, and .= instead of += and ' name' instead of 
$_POST['id_name'];

Also, real code should check whether any field has been already inserted in 
the $query_str before the comma will be used as separator.

> ..............
>
> 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 :)

A few dozens of iterations should be pretty fast. And this method is more 
'elegant' than linear - if( x==1)... else if( x==2) ... else if( x==3).. way.

>
> I hope it helps
> Asia Sledzik

Me too... ;-)
  Mariusz
- -- 
        [http://skoot.qi.pl for GPG keys]
"A computer programmer is someone who, when told to "Go to Hell", sees
the "Go to", rather than the destination, as harmful."
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)

iD8DBQE/5yOxvkWo15WV1rkRArQUAJ9Yg6hjGUSrDjq665TpX6Wfe/X3YwCfU0vh
3Lpd8mZ51K6AvnqUax7B1zs=
=+pJE
-----END PGP SIGNATURE-----





^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: Interactive querys
@ 2003-12-22 12:41 ripley@gazeta.pl
  0 siblings, 0 replies; 6+ messages in thread

From: ripley@gazeta.pl @ 2003-12-22 12:41 UTC (permalink / raw)
  To: Ângelo Marcos Rigo <angelo_rigo@yahoo.com.br>; +Cc: pgsql-php

Hi Angelo




First take my apologise for my mistake  ;)


It shouldn't be  $query_str += ", ".$_POST["id_name"];, but 
$query_str .= ", ".$_POST["id_name"];




The '.' it's a concatenation of strings and variables:


if $_POST["id_name"]=15,  it gives you ", 15"




The '$query_str .=' it is taken from C language - it is equivalent 
to $query_str = $query_str.", ".$_POST["id_name"] 




Aaa.... and don't forget about adding '' when you want to insert a 
string into query: "'".$_POST["name_tx"]."'" //I always forget about 
it  =D//




Happy To Helped


Asia Sledzik


------ Wiadomość oryginalna ------


Od:    Ângelo Marcos Rigo <angelo_rigo@yahoo.com.br>


Data:  2003-12-22 12:23


Temat: Re: [PHP] Interactive querys




:-> Thank´s Sledzik


:-> Now it is very clear! the query will just concatenate


:-> :


:-> Let me ask about the . in: .$_POST["id_name"] :-> from :


:-> 


:-> $query_str += ", ".$_POST["id_name"];


:-> 


:-> this syntax is not familiar to me yet , what it does?


:-> 


:-> thank´s in advance


 


:-> ----- Wiadomo?? oryginalna ------


:-> 


:-> 


:-> Od:    Ângelo Marcos Rigo <angelo_rigo@yahoo.com.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"


:-> 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


:-> 



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



^ permalink  raw  reply  [nested|flat] 6+ messages in thread


end of thread, other threads:[~2003-12-22 17:02 UTC | newest]

Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2003-12-15 12:46 Interactive querys Ângelo Marcos Rigo <angelo_rigo@yahoo.com.br>
2003-12-15 13:02 ` Marek Lewczuk <newsy@lewczuk.com>
2003-12-15 13:23   ` Ângelo Marcos Rigo <angelo_rigo@yahoo.com.br>
2003-12-22 10:46     ` ripley@gazeta.pl
2003-12-22 17:02       ` Mariusz Pekala <skoot@qi.pl>
2003-12-22 12:41 Re: Interactive querys ripley@gazeta.pl

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox