Platon Technologies
not logged in Login Registration
EnglishSlovak
open source software development celebrating 10 years of open source development! Wednesday, November 11, 2026
About Us
Magazine
Open Source
CVS
Services
Index  »  Projects  »  phpMyEdit  »  Forum  »  sorting table using multiple filters

phpMyEdit General     sorting table using multiple filters
Post new topic   Reply to topic    
 
johnmarcel     Joined: 27 May 2011   Posts: 1  
Post Posted: 2011-05-27 19:27
Back to top  Reply with quote     

I am having a problem with sorting the table by clicking on the labels in the table header.
whenever I have more than one filter I get an error but, when their is only one it works posted below is the entire code but here is just the filter set I am trying to use.
$opts['filters'] = "$whereClause $client";
this is the error Iam receiving


MySQL error 1064
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND at_client_sn='423')' at line 1
--------------------------------------------------------------------------------

appointment_sn_text Address1 Address2 Recipient ID City Patient First Name Patient Last Name Date Language State Time Type Appt Type Zip Interpreters First Name Interpreters Last Name
MySQL error 1064
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND at_client_sn='423') ORDER BY `PMEtable0`.`appointment_sn_text` LIMIT 0, 15' at line 1
--------------------------------------------------------------------------------

phpMyEdit error: invalid SQL query

--------------------------------------------------------------------------------
SELECT `PMEtable0`.`appointment_sn_text` AS `qf0`,`PMEtable0`.`at_address1` AS `qf1`,`PMEtable0`.`at_address2` AS `qf2`,`PMEtable0`.`at_case` AS `qf3`,`PMEtable0`.`at_city` AS `qf4`,`PMEtable0`.`at_claimant_first_name` AS `qf5`,`PMEtable0`.`at_claimant_last_name` AS `qf6`,`PMEtable0`.`at_date` AS `qf7`,`PMEtable0`.`at_language` AS `qf8`,`PMEtable0`.`at_state` AS `qf9`,`PMEtable0`.`at_time` AS `qf10`,`PMEtable0`.`at_type` AS `qf11`,`PMEtable0`.`at_via` AS `qf12`,`PMEtable0`.`at_zip` AS `qf13`,`PMEtable0`.`INTERPRETERSbyInterpreterSN::ir_first_name` AS `qf14`,`PMEtable0`.`INTERPRETERSbyInterpreterSN::ir_last_name` AS `qf15` FROM `data` AS `PMEtable0` WHERE ( AND at_client_sn='423') ORDER BY `PMEtable0`.`appointment_sn_text` LIMIT 0, 154.378 miliseconds





my code:

Code:

<style type="text/css">
   hr.pme-hr           { border: 0px solid; padding: 0px; margin: 0px; border-top-width: 1px; height:

1px; }
   table.pme-main         { border: #004d9c 1px solid; border-collapse: collapse; border-spacing: 0px; width:

100%; }
   table.pme-navigation { border: #004d9c 0px solid; border-collapse: collapse; border-spacing: 0px; width:

100%; }
   td.pme-navigation-0, td.pme-navigation-1 { white-space: nowrap; }
   th.pme-header        { border: #004d9c 1px solid; padding: 4px; background: #add8e6; }
   td.pme-key-0, td.pme-value-0, td.pme-help-0, td.pme-navigation-0, td.pme-cell-0,
   td.pme-key-1, td.pme-value-1, td.pme-help-0, td.pme-navigation-1, td.pme-cell-1,
   td.pme-sortinfo, td.pme-filter { border: #004d9c 1px solid; padding: 3px; }
   td.pme-buttons { text-align: left;   }
   td.pme-message { text-align: center; }
   td.pme-stats   { text-align: right;  }
</style><?php

/*
* IMPORTANT NOTE: This generated file contains only a subset of huge amount
* of options that can be used with phpMyEdit. To get information about all
* features offered by phpMyEdit, check official documentation. It is available
* online and also for download on phpMyEdit project management page:
*
* http://platon.sk/projects/main_page.php?project_id=5
*
* This file was generated by:
*
*                    phpMyEdit version: 5.7.1
*       phpMyEdit.class.php core class: 1.204
*            phpMyEditSetup.php script: 1.50
*              generating setup script: 1.50
*/


$searchterm=$_GET['searchterm'];
$searchterm1=$_GET['searchterm1'];
$searchterm2=$_GET['searchterm2'];
$searchterm3=$_GET['searchterm3'];
$searchterm4=$_GET['searchterm4'];
$searchterm5=$_GET['searchterm5'];

if ($searchterm != "") {
   $whereClause = "$whereClause at_claimant_first_name LIKE '%$searchterm%' OR";
}
   
if ($searchterm1 != "") {
   $whereClause = "$whereClause at_claimant_last_name LIKE '%$searchterm1%' OR";
}

if ($searchterm2 != "") {
   $whereClause = "$whereClause at_case = '$searchterm2' OR";
}

if ($searchterm3 != "") {
   $whereClause = "$whereClause at_claimant_phone_number LIKE '%$searchterm3%' OR";
}   
   
if ($searchterm4 != "") {
   $whereClause = "$whereClause at_date ='$searchterm4' OR";
}
if ($searchterm5 != "") {
   $whereClause = "$whereClause appointment_sn_text ='$searchterm5' OR";
}      
   // Check length of Where Clause  - if 6 i.e. "WHERE " then no option selected so set string to "" otherwise

remove the trailing "OR" by taking off the last two characters
if (strlen($whereClause) ==6) {
      $whereClause = "";
} else {
      $whereClause = substr($whereClause,0,(strlen($whereClause))-2);
}


$client="AND at_client_sn='423'";

// MySQL host name, user name, password, database, and table
$opts['hn'] = '******';
$opts['un'] = '*****';
$opts['pw'] = '******';
$opts['db'] = '*****';
$opts['tb'] = '*****';
$opts['filters'] = "$whereClause $client";


// Name of field which is the unique key
$opts['key'] = 'appointment_sn_text';

// Type of key field (int/real/string/date etc.)
$opts['key_type'] = 'int';

// Sorting field(s)
$opts['sort_field'] = array('appointment_sn_text');

// Number of records to display on the screen
// Value of -1 lists all records in a table
$opts['inc'] = 15;

// Options you wish to give the users
// A - add,  C - change, P - copy, V - view, D - delete,
// F - filter, I - initial sort suppressed
$opts['options'] = 'ACPVDF';

// Number of lines to display on multiple selection filters
$opts['multiple'] = '4';

// Navigation style: B - buttons (default), T - text links, G - graphic links
// Buttons position: U - up, D - down (default)
$opts['navigation'] = 'DB';

// Display special page elements
$opts['display'] = array(
   'form'  => true,
   'query' => true,
   'sort'  => true,
   'time'  => true,
   'tabs'  => true
);

// Set default prefixes for variables
$opts['js']['prefix']               = 'PME_js_';
$opts['dhtml']['prefix']            = 'PME_dhtml_';
$opts['cgi']['prefix']['operation'] = 'PME_op_';
$opts['cgi']['prefix']['sys']       = 'PME_sys_';
$opts['cgi']['prefix']['data']      = 'PME_data_';

/* Get the user's default language and use it if possible or you can
   specify particular one you want to use. Refer to official documentation
   for list of available languages. */
$opts['language'] = $_SERVER['HTTP_ACCEPT_LANGUAGE'] . '-UTF8';

/* Table-level filter capability. If set, it is included in the WHERE clause
   of any generated SELECT statement in SQL query. This gives you ability to
   work only with subset of data from table.

$opts['filters'] = "column1 like '%11%' AND column2<17";
$opts['filters'] = "section_id = 9";
$opts['filters'] = "PMEtable0.sessions_count > 200";
*/

/* Field definitions
   
Fields will be displayed left to right on the screen in the order in which they
appear in generated list. Here are some most used field options documented.

['name'] is the title used for column headings, etc.;
['maxlen'] maximum length to display add/edit/search input boxes
['trimlen'] maximum length of string content to display in row listing
['width'] is an optional display width specification for the column
          e.g.  ['width'] = '100px';
['mask'] a string that is used by sprintf() to format field output
['sort'] true or false; means the users may sort the display on this column
['strip_tags'] true or false; whether to strip tags from content
['nowrap'] true or false; whether this field should get a NOWRAP
['select'] T - text, N - numeric, D - drop-down, M - multiple selection
['options'] optional parameter to control whether a field is displayed
  L - list, F - filter, A - add, C - change, P - copy, D - delete, V - view
            Another flags are:
            R - indicates that a field is read only
            W - indicates that a field is a password field
            H - indicates that a field is to be hidden and marked as hidden
['URL'] is used to make a field 'clickable' in the display
        e.g.: 'mailto:$value', 'http://$value' or '$page?stuff';
['URLtarget']  HTML target link specification (for example: _blank)
['textarea']['rows'] and/or ['textarea']['cols']
  specifies a textarea is to be used to give multi-line input
  e.g. ['textarea']['rows'] = 5; ['textarea']['cols'] = 10
['values'] restricts user input to the specified constants,
           e.g. ['values'] = array('A','B','C') or ['values'] = range(1,99)
['values']['table'] and ['values']['column'] restricts user input
  to the values found in the specified column of another table
['values']['description'] = 'desc_column'
  The optional ['values']['description'] field allows the value(s) displayed
  to the user to be different to those in the ['values']['column'] field.
  This is useful for giving more meaning to column values. Multiple
  descriptions fields are also possible. Check documentation for this.
*/

$opts['fdd']['appointment_sn_text'] = array(
  'name'     => 'Appointment sn text',
  'select'   => 'T',
  'maxlen'   => 15,
  'sort'     => true
);
$opts['fdd']['at_72hr_varification'] = array(
  'name'     => 'At 72hr varification',
  'select'   => 'T',
  'maxlen'   => 145,
  'sort'     => true
);
$opts['fdd']['at_address1'] = array(
  'name'     => 'At address1',
  'select'   => 'T',
  'maxlen'   => 145,
  'sort'     => true
);
$opts['fdd']['at_address2'] = array(
  'name'     => 'At address2',
  'select'   => 'T',
  'maxlen'   => 145,
  'sort'     => true
);
$opts['fdd']['at_careoregon_status'] = array(
  'name'     => 'At careoregon status',
  'select'   => 'T',
  'maxlen'   => 145,
  'sort'     => true
);
$opts['fdd']['at_case'] = array(
  'name'     => 'At case',
  'select'   => 'T',
  'maxlen'   => 145,
  'sort'     => true
);
$opts['fdd']['at_cconfirmation_requested'] = array(
  'name'     => 'At cconfirmation requested',
  'select'   => 'T',
  'maxlen'   => 145,
  'sort'     => true
);
$opts['fdd']['at_city'] = array(
  'name'     => 'At city',
  'select'   => 'T',
  'maxlen'   => 145,
  'sort'     => true
);
$opts['fdd']['at_claimant_first_name'] = array(
  'name'     => 'At claimant first name',
  'select'   => 'T',
  'maxlen'   => 145,
  'sort'     => true
);
$opts['fdd']['at_claimant_last_name'] = array(
  'name'     => 'At claimant last name',
  'select'   => 'T',
  'maxlen'   => 145,
  'sort'     => true
);
$opts['fdd']['at_claimant_phone_number'] = array(
  'name'     => 'At claimant phone number',
  'select'   => 'T',
  'maxlen'   => 145,
  'sort'     => true
);
$opts['fdd']['at_client_sn'] = array(
  'name'     => 'At client sn',
  'select'   => 'T',
  'maxlen'   => 145,
  'sort'     => true
);
$opts['fdd']['at_contact'] = array(
  'name'     => 'At contact',
  'select'   => 'T',
  'maxlen'   => 145,
  'sort'     => true
);
$opts['fdd']['at_date'] = array(
  'name'     => 'At date',
  'select'   => 'T',
  'maxlen'   => 145,
  'sort'     => true
);
$opts['fdd']['at_department'] = array(
  'name'     => 'At department',
  'select'   => 'T',
  'maxlen'   => 145,
  'sort'     => true
);
$opts['fdd']['at_Email_Address_Clinic'] = array(
  'name'     => 'At Email Address Clinic',
  'select'   => 'T',
  'maxlen'   => 145,
  'sort'     => true
);
$opts['fdd']['at_email_notes'] = array(
  'name'     => 'At email notes',
  'select'   => 'T',
  'maxlen'   => 145,
  'sort'     => true
);
$opts['fdd']['at_emailcheck'] = array(
  'name'     => 'At emailcheck',
  'select'   => 'T',
  'maxlen'   => 145,
  'sort'     => true
);
$opts['fdd']['at_fax_number'] = array(
  'name'     => 'At fax number',
  'select'   => 'T',
  'maxlen'   => 45,
  'sort'     => true
);
$opts['fdd']['at_initial_varification'] = array(
  'name'     => 'At initial varification',
  'select'   => 'T',
  'maxlen'   => 145,
  'sort'     => true
);
$opts['fdd']['at_Interprerer_confirmed'] = array(
  'name'     => 'At Interprerer confirmed',
  'select'   => 'T',
  'maxlen'   => 45,
  'sort'     => true
);
$opts['fdd']['at_interpreter_sn'] = array(
  'name'     => 'At interpreter sn',
  'select'   => 'T',
  'maxlen'   => 45,
  'sort'     => true
);
$opts['fdd']['at_language'] = array(
  'name'     => 'At language',
  'select'   => 'T',
  'maxlen'   => 145,
  'sort'     => true
);
$opts['fdd']['at_phone'] = array(
  'name'     => 'At phone',
  'select'   => 'T',
  'maxlen'   => 45,
  'sort'     => true
);
$opts['fdd']['at_something_no_idea'] = array(
  'name'     => 'At something no idea',
  'select'   => 'T',
  'maxlen'   => 145,
  'sort'     => true
);
$opts['fdd']['at_state'] = array(
  'name'     => 'At state',
  'select'   => 'T',
  'maxlen'   => 45,
  'sort'     => true
);
$opts['fdd']['at_time'] = array(
  'name'     => 'At time',
  'select'   => 'T',
  'maxlen'   => 45,
  'sort'     => true
);
$opts['fdd']['at_type'] = array(
  'name'     => 'At type',
  'select'   => 'T',
  'maxlen'   => 145,
  'sort'     => true
);
$opts['fdd']['at_via'] = array(
  'name'     => 'At via',
  'select'   => 'T',
  'maxlen'   => 145,
  'sort'     => true
);
$opts['fdd']['at_zip'] = array(
  'name'     => 'At zip',
  'select'   => 'T',
  'maxlen'   => 45,
  'sort'     => true
);
$opts['fdd']['INTERPRETERSbyInterpreterSN::ir_first_name'] = array(
  'name'     => 'INTERPRETERSbyInterpreterSN::ir first name',
  'select'   => 'T',
  'maxlen'   => 145,
  'sort'     => true
);
$opts['fdd']['INTERPRETERSbyInterpreterSN::ir_HIPAAbox'] = array(
  'name'     => 'INTERPRETERSbyInterpreterSN::ir HIPAAbox',
  'select'   => 'T',
  'maxlen'   => 45,
  'sort'     => true
);
$opts['fdd']['INTERPRETERSbyInterpreterSN::ir_last_name'] = array(
  'name'     => 'INTERPRETERSbyInterpreterSN::ir last name',
  'select'   => 'T',
  'maxlen'   => 145,
  'sort'     => true
);
$opts['fdd']['at_actual_minutes'] = array(
  'name'     => 'At actual minutes',
  'select'   => 'T',
  'maxlen'   => 45,
  'sort'     => true
);

// Now important call to phpMyEdit
require_once 'phpMyEdit.class.php';
new phpMyEdit($opts);

?>


 
Post new topic   Reply to topic    

Copyright © 2002-2006 Platon Group
Site powered by Metafox CMS
Go to Top · Feedback form · Application form
Report bug on PLATON.SK website · Terms of use · Privacy policy