Platon Technologies
neprihlásený Prihlásiť Registrácia
SlovakEnglish
open source software development oslavujeme 10 rokov vývoja otvoreného softvéru! Streda, 11. november 2026
O nás
Magazín
Otvorený softvér
CVS
Služby
Index  »  Projekty  »  phpMyEdit  »  Fórum  »  Call table with URL name value pair

phpMyEdit Configuration     Call table with URL name value pair
Odoslať novú tému   Odpovedať na tému    
 
Batninja     Založený: 19.09.2008   Príspevky: 2  
Príspevok Zaslal: 2008-09-19 21:55
Návrat hore  Odpovedať s citátom     

Hi hope someone can help

I can't seem to figure out how to query the database using a name value pair from the calling URL.

My table is 4 columns, ID, Course, Date and Location and I want to filter the table by Course, i.e. call the table using something like schedule.php?course=Excel I saw on one post that you can use qf1 but it doesnt work and just returns all the data.

Any help gratefully received, thanks

Bats

 
thefeldkircher     Založený: 11.10.2008   Príspevky: 9  
Príspevok Zaslal: 2008-10-11 09:54
Návrat hore  Odpovedať s citátom     

Batninja Napísal:
Hi hope someone can help

I can't seem to figure out how to query the database using a name value pair from the calling URL.

My table is 4 columns, ID, Course, Date and Location and I want to filter the table by Course, i.e. call the table using something like schedule.php?course=Excel I saw on one post that you can use qf1 but it doesnt work and just returns all the data.

Any help gratefully received, thanks

Bats



Hi, after dredging through the online docs this how I found a way to do it.

place your URL on the column you wish to use as the filter, in your case Course...

Kód:
$opts['fdd']['Course'] = array(
  'name'     => 'Course',
  'select'   => 'T',
  'maxlen'   => 10,
  'URL'       => 'courses.php?course=$value',
  'URLtarget'   => '_blank',
  'sort'     => true
);


$value is the value of the field your mouse is hovering over.

Now inside courses.php place the following in between your !Doctype and html tags

Kód:


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
      "http://www.w3.org/TR/html4/loose.dtd">      

      
<?php
// Use this to filter for Course
$course = @$_REQUEST['course'];
?>      
      
<html>
<head>



Now scroll down until you find

Kód:
// 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_';


We add a persist prefix to the end of this list so our URL data is available across all screens, ie Add, Change, Copy and Delete. So append to bottom, this line.

Kód:
$opts['cgi']['persist'] = array('course' => $course);


And finally we apply a Filter to our value - the Filters are usually commented out under the Langauge option - uncomment one and set it so.

Kód:
/* 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'] = 'Course REGEXP "^'.$course.'"';


Now when you call your courses.php, all you should see is a list of the single course.

Hope it helps..

 
Batninja     Založený: 19.09.2008   Príspevky: 2  
Príspevok Zaslal: 2008-10-13 17:05
Návrat hore  Odpovedať s citátom     

Thanks I'll try this out

Roger

 
Odoslať novú tému   Odpovedať na tému    

Copyright © 2002-2006 Platon Group
Stránka používa redakčný systém Metafox
Na začiatok · Odkazový formulár · Prihláška
Upozorniť na chybu na PLATON.SK webstránke · Podmienky použitia · Ochrana osobných údajov