| Index
» Projekty
» phpMyEdit
» Fórum
» $opts['cgi']['persist'] causing problems |
 |
adler
Založený: 06.01.2011
Príspevky: 5
Zaslal: 2011-01-06 15:39
Návrat hore
Odpovedať s citátom
|
Hi,
first of all thank you for this great great tool!
i'm having this problem:
i have 2 phpMyEdit pages, one shows a table of suppliers and the other show a table of parts.
i'm using the URL option in the supplier name field definition so that clicking on a supplier will call the parts page with a GET call, so that only parts of this supplier will show. the URL definition is:
| Kód: |
| $opts['fdd']['supplierName']['URL'] = 'Parts.php?sup=$key'; |
and then in Products.php i'm using:
$sup = $_REQUEST['sup'];
to extract the GET value (which is the key of the supplier that the user clicked).
then, to filter the table i'm using:
| Kód: |
| $opts['filters'] = "SUP = $sup"; |
and in the field definition for SUP (which is the key for the supplier's table) i'm using:
| Kód: |
$opts['fdd']['SUP'] = array(
'name' => 'SUP',
'default' => $sup,
'options' => 'ACPVD',
'input' => 'R'
); |
as the manual suggest, i'm using:
| Kód: |
| $opts['cgi']['persist'] = array( 'sup' => $sup; |
to maintain the filteration on every screen.
until here everything works great and the filteration works well.
THE PROBLEM:
lets say that i'm viewing the parts of a certain supplier. if i'm deleting a single specific part, all of the parts for that supplier is deleted! i get a message, like: "5 records deleted".
why is it deleting all of the suppplier's parts and not just the one i've selected to delete??
please help me... i dont have a clue..
thank you very much :)
p.s. i don't know if it matters but the PK of the parts table consists of 2 fields: SUP (supplier ID) and PART (part ID). currently only the SUP is declared in Parts.php as the key. is this ok? is this the problem maybe?
|
adler
Založený: 06.01.2011
Príspevky: 5
Zaslal: 2011-01-06 16:35
Návrat hore
Odpovedať s citátom
|
yes, indeed the problem is that PME cant handle multiple fields as PK, took me a while to get there.. so i simply added a system auto-inc PK for the parts table and removed the PK from SUP and PART... now its works great!
|
doug
Založený: 10.02.2003
Príspevky: 1013
Bydlisko: Denver, Colorado (USA)
Zaslal: 2011-01-08 14:38
Návrat hore
Odpovedať s citátom
|
Yes, phpMyEdit expects the first column to be the only primary key column. Documentation should probably be updated to reflect that more prominently.
http://opensource.platon.sk/projects/doc.php/phpMyEdit/html/configuration.unique-key.html
|
adler
Založený: 06.01.2011
Príspevky: 5
Zaslal: 2011-01-08 20:10
Návrat hore
Odpovedať s citátom
|
;)
|
|
Odoslať novú tému
Odpovedať na tému
|
|
|
|