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
Date: Mon, 22 Dec 2003 13:41:46 +0100 (CET)
Message-ID: <1072096906867.ew10.ripley@gazeta.pl> (raw)
In-Reply-To: <20031222112338.83525.qmail@web14812.mail.yahoo.com>

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)



view thread (6+ messages)  latest in thread

Message-ID: <1072096906867.ew10.ripley@gazeta.pl>
Permalink:  ../1072096906867.ew10.ripley@gazeta.pl/
Also on:    postgresql.org/message-id/1072096906867.ew10.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
  In-Reply-To: <1072096906867.ew10.ripley@gazeta.pl>
  References: <20031222112338.83525.qmail@web14812.mail.yahoo.com> <1072096906867.ew10.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