By: Jorge
Date: 2004-01-04
Time: 05:57
|
Split SQL request into many parts with conditions
Hi,
I have more time and consider to implement TBS into a Website I'm working on now.
TBS works fine (at least when I have examples from your help file)
By the way, I'm trying to split my SQL queries into more than one line and intreduce conditions
I would like to know how could I do something like:
-of course this code doesn't work!! it's here only for help perposes..:) -
$TBS->MergeBlock("blk1",$cnx_id,"select id, name from table") ;
if ($id){ //value passed from previous page
$TBS->MergeBlock("blk1",$cnx_id," where id='".$id."'");
}
What's the best way to implement this condition with TBS?
Thanks
Jorge
|
By: Jorge
Date: 2004-01-04
Time: 06:11
|
Re: Split SQL request into many parts with conditions
I need to sleep...found a so simple solution
(was reading to much your examples, and solution was already into php concept)
Solution (for other beginners, or people needing to sleep like me!)
$query = "select id, name from table";
if ($id){ //value passed from previous page
$query .= " where id='".$id."'"; // note the '.' after 'query'
}
$TBS->MergeBlock("blk1",$cnx_id,$query) ;
|