You are not logged in.

Announcement

 Téléchargez la dernière version stable de GLPI      -     Et vous, que pouvez vous faire pour le projet GLPI ? :  Contribuer
 Download last stable version of GLPI                      -     What can you do for GLPI ? :  Contribute

#1 2014-10-08 01:50:56

jdag1992
Member
Registered: 2014-09-26
Posts: 21

SQL Query

Hi
I'm trying to generate a consult by id on Reports Plugins...
I have this code:
<?php
$USEDBREPLICATE= 1;
$DBCONNECION_REQUIRED= 0;
include ("../../../../inc/includes.php");
//TRANS: PRUEBA
include_once 'cons.en_GB.php';
$report = new PluginReportsAutoReport($LANG['plugin_reports']['cons']);
//new PluginReportsDateIntervalCriteria($report, "`glpi_logs`.`date_mod`");
new PluginReportsTextCriteria($report, 'id', __('ID'));
$report->displayCriteriasForm();
// Declare columns
if($report->criteriasValidated()) {
   $itemtype = $_POST['itemtype'];
   $table = getTableForItemType($itemtype);
$report->setColumns(array(
                          new PluginReportsColumn('name', __('Nombre')),
                          new PluginReportsColumn('id', __('ID')),
                          ));
$query = "SELECT `name`,`id` from `glpi_tickets` WHERE `id` " .$report->addSqlCriteriasRestriction() ;


   $report->setSqlRequest($query);
   $report->execute();
}
?>
This code work's fine, but the results of query are not what I want.
The query shows me those tickets where the id is the id number that I put to find
Example, if I put 1 in the search shows me all IDs that have the number 1: 1, 10, 11, 21, 31 ...
What should I do to make it an exact query?
Please help! Thanks

Offline

Board footer

Powered by FluxBB