Platon Technologies
neprihlásený Prihlásiť Registrácia
SlovakEnglish
open source software development oslavujeme 10 rokov vývoja otvoreného softvéru! Piatok, 19. apríl 2024
O nás
Magazín
Otvorený softvér
CVS
Služby
Index  »  Projekty  »  phpMyEdit  »  Fórum  »  Update MoreAdd to increment a default

phpMyEdit Configuration     Update MoreAdd to increment a default
Odoslať novú tému   Odpovedať na tému    
 
Tom Moulton     Založený: 03.09.2018   Príspevky: 7  
Príspevok Zaslal: 2018-09-03 17:40
Návrat hore  Odpovedať s citátom     

I have a table like:

CREATE TABLE `Levels` (
`level_id` int(10) NOT NULL,
`point_id` int(10) NOT NULL,
`date` date NOT NULL,
`level` decimal(7,2) NOT NULL DEFAULT '0.00'
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

The point_id refers to another table with names, etc.

When Adding a new "Level" the point_id defaults to 1 how can I have the point_id increment when clicking MORE?

Is there a way to capture the last point_id used in an update? Then I could have last_point_id+1 as the default value in the form.

I assume it has something to do with the 'cgi' fields but I am not sure how to get started.

Thanks!
Tom

ps. Upon thinking more, it might be interesting to make the level_id, point_id (maybe others) persistent in general

 
doug     Založený: 10.02.2003   Príspevky: 1013   Bydlisko: Denver, Colorado (USA)
Príspevok Zaslal: 2018-09-07 17:48
Návrat hore  Odpovedať s citátom     

You'd need to create a trigger or two. Lookup the current large id, add 1, and display the resullt in add mode, for example.

 
Tom Moulton     Založený: 03.09.2018   Príspevky: 7  
Príspevok Zaslal: 2018-09-09 14:21
Návrat hore  Odpovedať s citátom     

doug Napísal:
You'd need to create a trigger or two. Lookup the current large id, add 1, and display the resullt in add mode, for example.


Ok, I have tried a few things like:

using sessions to keep track of the last 'position_id'
painful, the retained id only updated every other MORE entry

Looked at using persist CGI vars, but those seem to need to be constants for the most part

Re-reading your reply, "Lookup the current"

Then it hit me, look it up via SQL

Thanks!
Tom

 
doug     Založený: 10.02.2003   Príspevky: 1013   Bydlisko: Denver, Colorado (USA)
Príspevok Zaslal: 2018-09-09 14:42
Návrat hore  Odpovedať s citátom     

On the link below, find the link to trigger examples.

http://www.hockinson.com/php_form_generator/app-docs.php

 
Tom Moulton     Založený: 03.09.2018   Príspevky: 7  
Príspevok Zaslal: 2018-09-09 21:36
Návrat hore  Odpovedať s citátom     

Interesting "characteristic" of insert 'pre' triggers

The class structure $this has the FDD elements entered by hash and index

I have been updating $this->fdd['point_id']['default'] but the display_add_record() function uses $this->fdd[1]['default']

So I guess I will have to use the index instead of the associative array

I added some error checking...

Tom

 
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