Home News Contact Us Forum About Us Demos Products F.A.Q.
Shopping Cart
You currently have 0 items in your cart.


Recent Events
  • 23/11/2024 Black Friday 2024

    BIG SALE, 30% discount for all our extensions. Use BF24 coupon code. Hurry up the discount is valid till 3 December.

  • 31/12/2023 New Year SALE

    We are glad to announce New Year SALE. 25% discount for all our extensions. Use NY24 coupon code. Hurry up the discount is valid till 7 January.


2Checkout.com, Inc. is an authorized retailer of goods and services provided by ARI Soft. 2CheckOut




Follow us on twitter



Welcome, Guest
Please Login or Register.    Lost Password?

Using php variables in query
(1 viewing) (1) Guest
Go to bottomPage: 1
TOPIC: Using php variables in query
#27192
Using php variables in query 12 Years, 7 Months ago Karma: 1
Hi, i would like to know a way to show the results of a table based on the article title...

Im trying SELECT descricao,comprimento,altura,largura FROM rqctx_sofas_db WHERE modelo='$title'
but it doesnt work.
Is there any way i can do it?

Thanks
The administrator has disabled public write access.
 
#27193
Re:Using php variables in query 12 Years, 7 Months ago Karma: 760
Hello,

It is possible to use request variables and some predefined variables (list of the predefined variables can be found in tooltip for "SQL -> SQL query" parameter) in WHERE caluse, but it is not possible to use article title.

Regards,
ARI Soft
The administrator has disabled public write access.
 
#27194
Re:Using php variables in query 12 Years, 7 Months ago Karma: 1
Nice, so I guess it isnt hard to add another tag like {$ArticleTitle} by making some changes on the source code right?
Can you help me doing that?
The administrator has disabled public write access.
 
#27198
Re:Using php variables in query 12 Years, 7 Months ago Karma: 760
You can modify the next file:

<joomla_directory>\modules\mod_aridatatables\includes\kernel\DataTables\Models\class.DataTablesDataSqlModel.php

See "prepareQuery" method.

Regards,
ARI Soft
The administrator has disabled public write access.
 
#27208
Re:Using php variables in query 12 Years, 7 Months ago Karma: 1
Thank you! Just did it and works fine, here is how I coded in case someone else needs it:

<joomla_directory>\modules\mod_aridatatables\includes\kernel\DataTables\Models\class.DataTablesDataSqlModel.php
inside the function prepareQuery($query)
Code:


                // Get Article Title
$option = JRequest::getCmd('option');
$view = JRequest::getCmd('view');

if ($option=="com_content" && $view=="article") {
$ids = explode(':',JRequest::getString('id'));
$article_id = $ids[0];
$article =& JTable::getInstance("content");
$article->load($article_id);
}
// End


$params = array(
'UserId' => $user->get('id'),
'UserGroupId' => $user->get('gid'),
'UserType' => $db->Quote($user->get('usertype')),
'UserName' => $db->Quote($user->get('name')),
'UserLogin' => $db->Quote($user->get('username')),
'UserBlock' => $user->get('block'),
'ArticleTitle' => $article->get("title") // Param Added
);

The administrator has disabled public write access.
 
Go to topPage: 1