pg.ddx.io  pgsql-php@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: ripley@gazeta.pl
To: Ângelo Marcos Rigo <angelo_rigo@yahoo.com.br>
Cc: pgsql-php@postgresql.org
Subject: Re: Interactive querys - reordering
Date: Tue, 23 Dec 2003 12:34:05 +0100 (CET)
Message-ID: <1072179245170.ew6.ripley@gazeta.pl> (raw)
In-Reply-To: <20031223110357.341.qmail@web14812.mail.yahoo.com>

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


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


Data:  2003-12-23 12:03


Temat: Re: [PHP] Interactive querys - final version




:-> Hi all


:-> 


:-> No problem in sharing the code to the list as i have


:-> done it before in others projects!


:-> 


:-> I am still looking for a no javascrit way to


:-> reordenate the items that will compose the query.


:-> Maybe an array function do this job i will research


:-> 


:-> The original idea come from a delphy ready made plugin


:-> that use buttons that can be selected and reordenated,


:-> 


:-> 


:-> So i think in the future the html <div></div> can play


:-> the role of the buttons, but the first version will be


:-> with two textareas


:-> 


:-> Grretings from Brasil


 


:-> =====


:-> Ângelo Marcos Rigo


------------------------------------------




Hi :)




It is possible to perform custom actions on PHP - similar to Java


The only problem is, that you will have to reload all your webpage:




Generally my idea of simulating java by PHP divides in two:


- putting links <a href...></a> which loads the same PHP script but 
with different values of variables provided by get


    like you're seeing next


    and in neccesary parts of script php use the condition if


    if ($_GET["var"] == "ascending")


        {....}


    if ($_GET["var1"] == "descending")


        {....}




- putting several submit buttons in a form - every submit has got 
the same name but different value


 you read submit buttons in the same way as other fields: 
$_POST["submit_name"] - value of this variable will simply depends


on which of submit buttons has the user clicked before.




and in neccesary parts of script php use the condition if


if ($_POST["submit1"] == "ascending")


    {....}


if ($_POST["submit1"] == "descending")


    {....};








Now your example:


---- BEWARE - IT DOESN'T WORK CORRECTLY !!! ------------


I've got one problem with passing by get string that contents spaces 
- in my case server can't do this include




But I'm sending it to you - probably you will now how to "heal" this 
script...






OK I'm assuming that you have one form with checkboxes, list and 
script "query-doit.php" in action


in "query-doit.php" you build the query_str with $_POST[] variables, 
send to database and


read the result and display the web page .




My idea is to add divide this script into 2 scripts


- the first is responsible for only building the query_str form 
checkboxes, lists etc. and sending the complete query string to


the second script with instruction include("http:
//page_adress/showresult.php?query_str=".$query_str."&sort_type=up")
;




 - second script, responsible only for querying to database and 
displaying the result, which will receive by get text of the query 
and the variable responsible for type of order




put in it, this two links


<a href="showresult.php?query_str=<? echo $query_str ?
>&sort_type=up>Up</a>


<a href="showresult.php?query_str=<? echo $query_str ?
>&sort_type=down>Down</a>




and after retriving a result from the database and putting it to 
variable $result


if ($_GET["sort_type"]=="up")


   {


     echo "<textarea>";


    .....read the $result variable with the for ($n=0; 
$n<=pg_num_rows($result)-1; $n++) {}


   echo "</textarea>";


    }


if ($_GET["sort_type"] == "down")


    {


    echo "<textarea>";


    .....read the $result with for ($n=pg_num_rows($result)-1;$n>=0;
$n--) {...}


    echo "</textarea>;


    }




If the user want's to reorder the positions of the query "down" - he 
will clik the link titled Down, which will cause the script to 
reload himself,


sending himself the same querystring but the different sort_type






Is that it what you're asking about?




Hope To Help


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)



Message-ID: <1072179245170.ew6.ripley@gazeta.pl>
Permalink:  ../1072179245170.ew6.ripley@gazeta.pl/
Also on:    postgresql.org/message-id/1072179245170.ew6.ripley@gazeta.pl

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-php@postgresql.org
  Cc: ripley@gazeta.pl, angelo_rigo@yahoo.com.br
  Subject: Re: Interactive querys - reordering
  In-Reply-To: <1072179245170.ew6.ripley@gazeta.pl>
  References: <20031223110357.341.qmail@web14812.mail.yahoo.com> <1072179245170.ew6.ripley@gazeta.pl>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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