| | |
need to update each records after record deleted
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
need to update each records after record
hi,
Would anyone share with me a code that can be used for this logic.
If i delete from a x records, record u.I need to update each records after record u till record x.the updation need to be carried out for the auto_increment field.
I think of a logic like this.
If need to delete the record,it should take the records after it,issue update query or update and then delete the record mentioned ,insert the updated records to database.
please some one help me by sharing this logic's code...or with a better code.
thanking you in advance i remain
sincerely
hbmarar
hi,
Would anyone share with me a code that can be used for this logic.
If i delete from a x records, record u.I need to update each records after record u till record x.the updation need to be carried out for the auto_increment field.
I think of a logic like this.
If need to delete the record,it should take the records after it,issue update query or update and then delete the record mentioned ,insert the updated records to database.
please some one help me by sharing this logic's code...or with a better code.
thanking you in advance i remain
sincerely
hbmarar
well,
i have wriiten a code for addressbook isn which i found a bug very late...I mean i have the following functions for the address book:-
Add,Update,Delete,Search,Showall. now once i have deleted a record the id which is autoincremented remains the same.so the deleted records id is never used again.
like this :
4|Harish|Balakrishnan|hbm@hbm.com|Phone|Pin
5|Balakr|HariKrishnan|bala@bala.com|Phone|pin
6|Harira|Balarishnan|bm@hbm.com|Phone|Pin
now if I delete record with id=5,resulting database view is like this
4|Harish|Balakrishnan|hbm@hbm.com|Phone|Pin
6|Harira|Balarishnan|bm@hbm.com|Phone|Pin
I need to use the id=5 which with the current logic is not utilised.
I think this would give you the need I mentioned in the thread.please help me with a code/function which before deletion updates all the records after the record deleted decrementing all the records after the deleted record id by 1;
Thanking you for the assurance that you could help me and I myself really expecting your favour
I remain
Hari
i have wriiten a code for addressbook isn which i found a bug very late...I mean i have the following functions for the address book:-
Add,Update,Delete,Search,Showall. now once i have deleted a record the id which is autoincremented remains the same.so the deleted records id is never used again.
like this :
4|Harish|Balakrishnan|hbm@hbm.com|Phone|Pin
5|Balakr|HariKrishnan|bala@bala.com|Phone|pin
6|Harira|Balarishnan|bm@hbm.com|Phone|Pin
now if I delete record with id=5,resulting database view is like this
4|Harish|Balakrishnan|hbm@hbm.com|Phone|Pin
6|Harira|Balarishnan|bm@hbm.com|Phone|Pin
I need to use the id=5 which with the current logic is not utilised.
I think this would give you the need I mentioned in the thread.please help me with a code/function which before deletion updates all the records after the record deleted decrementing all the records after the deleted record id by 1;
Thanking you for the assurance that you could help me and I myself really expecting your favour
I remain
Hari
•
•
Join Date: Apr 2005
Posts: 4
Reputation:
Solved Threads: 0
I'd redesign the logic if I were you. I never rely on auto updated keys for anything other than bookmarking a record.
i.e. I read it, store the auto update key cos I know it's unique, do whatever to the record, then update it using the auto update in the where clause. Better have a good design than patch up a poor one as it will only haunt you later.
i.e. I read it, store the auto update key cos I know it's unique, do whatever to the record, then update it using the auto update in the where clause. Better have a good design than patch up a poor one as it will only haunt you later.
•
•
•
•
Originally Posted by davespink
I'd redesign the logic if I were you. I never rely on auto updated keys for anything other than bookmarking a record.
i.e. I read it, store the auto update key cos I know it's unique, do whatever to the record, then update it using the auto update in the where clause. Better have a good design than patch up a poor one as it will only haunt you later.
Yes. You said is correct and my brother too say 'this way' that once he is to development there would not be a major re-designing required.'
But I am not him and thus would like to see this code working....
If you have alternative code do please share with me....
Thanking you I remain
Hari
![]() |
Similar Threads
- vb6 update record in the database (Visual Basic 4 / 5 / 6)
- Update Multiple Records (ASP)
- SQL Delete/Update Error (ColdFusion)
- Php newsletter error (PHP)
Other Threads in the PHP Forum
- Previous Thread: Apache rewrite map
- Next Thread: PHP image swapping ?
| Thread Tools | Search this Thread |
Tag cloud for PHP
.htaccess access ajax apache api array beginner binary broken cakephp checkbox class cms code cron curl database date development directory display download dynamic echo email error file files filter folder form forms function functions gc_maxlifetime google host href htaccess html image include insert integration ip java javascript joomla limit link login loop mail memmory memory menu mlm mod_rewrite multiple mysql navigation oop parse parsing paypal pdf php problem query radio random recursion regex remote script search server sessions sms snippet soap source space sql structure syntax system table thesishelp tutorial update upload url validation validator variable video web xml youtube





