By: daoxx
Date: 2010-03-18
Time: 16:15
|
Multiple sql queries in MergeBlock?Hi.
Tried to use subsequent sql queries in one MergeBlock call. Like this
Yes I can insert first query as subquery 3 times but that'll be not polite to DB :) And there may be more complicated query where i need to calculate intermediate results. Or, is TBS supports returning results of a sql query into php variable? Is it possible using only TBS 1) to get results by multiple dependent queries or 2) to get result from sql, use it in intrmediate calculations and then call single sql query? Thank you in advance |
|
By: daoxx
Date: 2010-03-18
Time: 16:44
|
Re: Multiple sql queries in MergeBlock?Forgot to tell that I use TBS in Joomla. And i'm not strong in programming
|
|
By: daoxx
Date: 2010-03-18
Time: 18:52
|
Re: Multiple sql queries in MergeBlock?well, I've found an answer no.2. (A tip about adding "*" to a block list in MergeBlock()).
Now I have a workaround. Thank you. |
|
By: Skrol29
Date: 2010-03-18
Time: 22:49
|
Re: Multiple sql queries in MergeBlock?Hi Daoxx,
It's important to know that TBS is only giving the SQL string as is to the data source. In your case TBS give the SQL string to MySQL using mysql_query(). It is possible to have TBS using another MySQL function for this, this can be done with a custom database plugin. By default, the native support for MySQL is mysql_query(). By default mysql_query() does not support multi results, nor multiple queries in the SQL statement. A post claims that it is possible by using a special flag with mysql_connection(). But I have not succeeded with this trick. http://www.php.net/manual/fr/function.mysql-query.php#91669 So the best way is to get the variables in PHP, and then build your SQL statement with only one query. As you are using Joomla, you can enjoy its internal connectivity PHP instance to get intermediate SQL results. |
|
By: daoxx
Date: 2010-03-19
Time: 19:10
|
Re: Multiple sql queries in MergeBlock?Thank you.
For now I used your trick with "*" block. I guess later I should have a more attentive look at Joomla gear. |