Menu Content

Support

> Forums, FAQs & Paid Support
Welcome, Guest
Username Password: Remember me

order query by a property column DESC how to???
(1 viewing) (1) Guest
Universal booking and reservations component for Joomla!.

NOTE: This category has been locked. If you have purchased paid version, please, use our Support Ticket system instead. If you are using free edition, please see the Community Support section.
  • Page:
  • 1

TOPIC: order query by a property column DESC how to???

order query by a property column DESC how to??? 12 years, 1 month ago #33947

Hi, i need help for a little modify to the query
this is the code i've already modify and it works,
if the property is set to ##*## it should filter the results where the property isn't "chiuso"

now i need to order the results by this property column DESC
this thing doen't work
i've tried adding after
}elseif ( $value=="##*##") {
this code
$query2 = ' , '.$id . '.`' . $name .' DESC ';

and i add at the end of the query
$query .= ' ORDER BY `sbj`.`ordering` ASC ';
$query .= $query2;

but it gives me error which is the right way?? please help me!!!

 
if (!empty($this->_lists['properties'])) {
// filter by template properties
foreach ($this->_lists['properties'] as $templateId => $properties) {
$template = $templateHelper->getTemplateById($templateId);
/* @var $template ATemplate */
$id = '`tmpl' . $templateId . '`'; // alias of template database table
foreach ($properties as $name => $param) { // check if properties has value to filter
$value = JString::trim($param['value']);
 
if ($value){
if ($param['type'] == 'text' || $param['type'] == 'textarea'){ // fulltext search
$where[] = $id . '.`' . $name . '` LIKE ' . $this->_db->Quote('%' . $value . '%');
$query2 ="";
}elseif ( $value=="##*##") {
 
$where[] = $id . '.`' . $name . '` NOT LIKE ' . $this->_db->Quote('%' . $closed . '%');
$query2 = ' , '.$id . '.`' . $name .' DESC ';
 
} else {// search by key
$where[] = $id . '.`' . $name . '` = ' . $this->_db->Quote($value);
$query2 ="";
}
}
}
if (!empty($where)) // there is params to filter - join with template
$query .= ' LEFT JOIN `' . $template->getDBTableName() . '` AS ' . $id . ' ON ' . $id . '.`id` = `sbj`.`id` ';
}
}
 


this is the error

Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean given in /home/w45184/domains/mydomain.com/public_html/libraries/joomla/database/database/mysqli.php on line 263

thank you for your help
The topic has been locked.

Re: order query by a property column DESC how to??? 12 years, 1 month ago #33948

the variable closed is set befor with
$closed="chiuso";
please help me if i have to pay tell me
it's urgent
thank you
The topic has been locked.

Re: order query by a property column DESC how to??? 12 years, 1 month ago #33969

  • maju
  • OFFLINE
  • Posts: 1107
Hello,

you should print your SQL $query to screen, copy it to phpmyadmin and try it. I see probably 1 problem in your SQL. You have not closed apostrophe after $name.

$query2 = ' , '.$id . '.`' . $name .'` DESC ';
ARTIO Support Team
The topic has been locked.

Re: order query by a property column DESC how to??? 12 years, 1 month ago #33985

Thank you very much, very stupid error! thank you!!bye
The topic has been locked.
  • Page:
  • 1
User Login Empty