Loupblanc
Založený: 09.08.2003
Príspevky: 7
Zaslal: 2003-08-10 08:09
Návrat hore
Odpovedať s citátom
|
Hi Doug
I tried this but I get a invalid mySQL error using id=1 in my URL.
| Kód: |
MySQL error 1064
You have an error in your SQL syntax near 'column = '1')' at line 1
MySQL error 1064
You have an error in your SQL syntax near 'column = '1') ORDER BY PMEtable0.akti_id,PMEtable0.akti_datum LIMIT 0,15' at line 1
phpMyEdit error: invalid SQL query
--------------------------------------------------------------------------------
SELECT PMEtable0.akti_id AS qf0,PMEtable0.akti_datum AS qf1,PMEtable0.akti_kategorie AS qf2,PMEtable0.akti_beschr AS qf3,PMEtable0.akti_kurz AS qf4,PMEtable0.akti_soll AS qf5,PMEtable0.akti_ist AS qf6 FROM 2004_helfer_akti AS PMEtable0 WHERE (column = '1') ORDER BY PMEtable0.akti_id,PMEtable0.akti_datum LIMIT 0,1525.735 miliseconds |
why?
|
nepto
Založený: 06.01.2003
Príspevky: 320
Bydlisko: Phoenix, Arizona (USA)
Zaslal: 2003-08-10 10:20
Návrat hore
Odpovedať s citátom
|
This is actually very funny. Name of field
column
was only an example. You have fields with different names. You have to use your column names, not the names presented in the Doug's example.
Hope this helps. ;-)
|
Loupblanc
Založený: 09.08.2003
Príspevky: 7
Zaslal: 2003-08-10 11:25
Návrat hore
Odpovedať s citátom
|
yep... very funny!
thank you very much! Can you tell me if there is a view to call the record in the view mode? (As I would click on the view button)
|
Loupblanc
Založený: 09.08.2003
Príspevky: 7
Zaslal: 2003-08-10 18:37
Návrat hore
Odpovedať s citátom
|
ok, thank you.
But, I'm affraid it's a little bit more difficulte (for me actually, as I'm a newbie in PHP). What I'd like to do:
I have to MySQL tables. The first one with volontaries (key, first name, last name, activity attended). The second one with the activities (key, activity description). Each volontary can choose one activity.
So in the volontary PHP-Page, I have this to combine activity attended and the activity table:
| Kód: |
$opts['fdd']['helfer_akti'] = array(
'name' => 'Helfer akti',
'select' => 'T',
'maxlen' => 6,
'default' => '0',
'required' => true,
'sort' => true,
'select' => 'D',
'values' => array(
'table' => '2004_helfer_akti',
'column' => 'akti_id',
'description' => 'akti_kurz'),
'URL' => 'http://www.myurl.com/phpmyedit/2004_helfer_akti.php?id=[****]',
'URLtarget' => '_blank'
);
|
[****]Here I'd like to give the key from the activity table (table='2004_helfer_akti' key='akti_id') so I can open the activity in the view mode in a new window.
The trouble is: I have no idea how to! ;)
Can someone help me?
|
Loupblanc
Založený: 09.08.2003
Príspevky: 7
Zaslal: 2003-08-14 19:24
Návrat hore
Odpovedať s citátom
|
Thank you Doug
Unfortunately, it's not the solution because $value gives me the value of 'akti_kurz' and not of 'akit_id' (the record key). $key doesn't work because the $key value is the value of the main table '2004_helfer_liste' and not of the table '2004_helfer_akti'.
If I want a URL like this
| Kód: |
| http://www.c1biker.com/phpmyedit/2004_helfer_akti.php?operation=Anzeigen&rec=$xxx |
where $xxx is the value of the recored key from the table 2004_helfer_akti I'll need an other one...
Feel free to have a look at
http://www.c1biker.com/phpmyedit/2004_helfer_liste.php
so you can understand what I mean. At the moment, the PHP-Code for the last column is
| Kód: |
$opts['fdd']['helfer_akti'] = array(
'name' => 'Helfer akti',
'select' => 'T',
'maxlen' => 6,
'default' => '0',
'required' => true,
'sort' => true,
'select' => 'D',
'values' => array(
'table' => '2004_helfer_akti',
'column' => 'akti_id',
'description' => 'akti_kurz'),
'URL' => 'http://www.c1biker.com/phpmyedit/2004_helfer_akti.php?operation=Anzeigen&rec=$key',
'URLtarget' => '_blank'
); |
|
Loupblanc
Založený: 09.08.2003
Príspevky: 7
Zaslal: 2003-08-25 08:51
Návrat hore
Odpovedať s citátom
|
| Doug Hockinson Napísal: |
| although names of fields and tables are causing me substantial confusion due to our different languages. |
OK, Doug. I give you some informations about both tables so the different languages don't cause you any problem ;):
Table 1:
2004_helfer_akti (Activities)
Fields:
akti_id
(integer, record key),
akti_datum
(date),
akti_kategorie
(text, category),
akti_beschr
(text, informations about the activity),
akti_kurz
(text, short name of the activity),
akti_soll
(integer, # volontary due),
akti_ist
(integer, # volontary intended).
Table 2:
2004_helfer_liste (List of Volontaries)
Fileds:
helfer_id
(integer, record key),
helfer_name
(text, last name of volontary),
helfer_vorname
(text, first name of volontary),
helfer_email
(text, e-mail address of volontary),
helfer_telefon
(text, phone number),
helfer_akti
(integer, id of activity attended = akti_id)
Now the PHP-Code:
| Kód: |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>2004_helfer_liste</title>
<style type="text/css">
table { border: #004d9c 1px solid; border-collapse: collapse; border-spacing: 0px; width: 100%; }
th { border: #004d9c 1px solid; padding: 4px; background: #add8e6; }
td { border: #004d9c 1px solid; padding: 3px; }
hr { border: 0px solid; padding: 0px; margin: 0px; border-top-width: 1px; height: 1px; }
</style>
</head>
<body>
<h3>2004_helfer_liste</h3><br>
Aktivitäten-Liste editieren: <a href="http://www.c1biker.com/phpmyedit/2004_helfer_akti.php" target="_blank">hier klicken!</a>
<?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://www.platon.sk/projects/main_page.php?project_id=5
*/
// MySQL host name, user name, password, database, and table
$opts['hn'] = 'localhost';
$opts['un'] = '********';
$opts['pw'] = '********';
$opts['db'] = 'c1biker';
$opts['tb'] = '2004_helfer_liste';
// Name of field which is the unique key
$opts['key'] = 'helfer_id';
// Type of key field (int/real/string/date etc.)
$opts['key_type'] = 'int';
// Sorting field(s)
$opts['sort_field'] = array('helfer_id');
// 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'] = 'BD';
// Display special page elements
$opts['display'] = array(
'query' => true,
'sort' => true,
'time' => true
);
/* 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'] = $HTTP_SERVER_VARS['HTTP_ACCEPT_LANGUAGE'];
/* 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'] = "Table0.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
['required'] true or false; if generate javascript to prevent null entries
['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']['helfer_id'] = array(
'name' => 'Helfer ID',
'select' => 'T',
'options' => 'AVCPDR',
'maxlen' => 6,
'default' => '0',
'sort' => true
);
$opts['fdd']['helfer_name'] = array(
'name' => 'Helfer name',
'select' => 'T',
'maxlen' => 65535,
'textarea' => array(
'rows' => 5,
'cols' => 50),
'required' => true,
'sort' => true
);
$opts['fdd']['helfer_vorname'] = array(
'name' => 'Helfer vorname',
'select' => 'T',
'maxlen' => 65535,
'textarea' => array(
'rows' => 5,
'cols' => 50),
'required' => true,
'sort' => true
);
$opts['fdd']['helfer_email'] = array(
'name' => 'Helfer email',
'select' => 'T',
'maxlen' => 65535,
'textarea' => array(
'rows' => 5,
'cols' => 50),
'required' => true,
'sort' => true,
'URL' => 'mailto:$value'
);
$opts['fdd']['helfer_telefon'] = array(
'name' => 'Helfer telefon',
'select' => 'T',
'maxlen' => 65535,
'textarea' => array(
'rows' => 5,
'cols' => 50),
'required' => true,
'sort' => true
);
$opts['fdd']['helfer_akti'] = array(
'name' => 'Helfer akti',
'select' => 'T',
'maxlen' => 6,
'default' => '0',
'required' => true,
'sort' => true,
'select' => 'D',
'values' => array(
'table' => '2004_helfer_akti',
'column' => 'akti_id',
'description' => 'akti_kurz'),
'URL' => 'http://www.c1biker.com/phpmyedit/2004_helfer_akti.php?operation=Anzeigen&rec=$key',
'URLtarget' => '_blank'
);
// Now important call to phpMyEdit
require_once 'phpMyEdit.class.php';
new phpMyEdit($opts);
?>
</body>
</html>
|
I hope it'll help... ;)
|
hbernard
Založený: 23.03.2003
Príspevky: 159
Bydlisko: FRANCE
Zaslal: 2003-12-08 22:04
Návrat hore
Odpovedať s citátom
|
Please read this :
http://opensource.platon.sk/forum/projects/viewtopic.php?p=703#703
| Loup Napísal: |
| Do someone have any idea??? |
|
kally
Založený: 05.01.2005
Príspevky: 14
Zaslal: 2007-05-29 09:06
Návrat hore
Odpovedať s citátom
|
This is an old post, but I thought my reply might help someone:
| Citácia: |
The sticky, persistent filter in form2.php is:
| Kód: |
array_key_exists('id',$_GET) ? $id = $_GET['id'] : $id = $rec ;
$opts['cgi']['persist'] = array('id' => $column);
$opts['filters'] = $id > 0 ? "column = '$id'" : ''; |
|
I am doing something similar. But, instead of an article, members are logging in and need to be restricted to seeing their record only.
I tried just the above code - using my variables, but it wasn't consistent and didn't seem to hold the correct ID going back and forth between views every time. I may have had a variable in the wrong place or maybe it just wasn't consistent.
I ended up changing the the last line to read:
| Kód: |
| $opts['filters'] = "memberID = '$memberID'"; |
That solved the inconsistencies and it is working good. Maybe my 'persist' line has an incorrect variable, but works because of the session. Don't know for sure, but it IS working.
The member ID is passed to the PME page from the login form. You could do the same thing to pass an article ID. I use sessions and register the id. There may be another way, but I need the session for other purposes, too. So this worked for me. Put it at the very top of your PME page:
| Kód: |
<?php
session_start();
$memberID = $_SESSION['id'];
?>
|
If this helps you, post a reply. :-)
Kally
|
|
Odoslať novú tému
Odpovedať na tému
|
|