Jump to content

PHP code to transcribe MySQL fields


phs2911

Recommended Posts

Okay, maybe it's late but I'm scratching my head over this one.  I have a MySQL table that has data like this:

 

prior_status    current_status

inactive                      active

inactive                      active

inactive                      inactive

inactive                      active

inactive                      inactive

 

I'm trying to figure a way to transcribe the columns (from current_status TO prior_status) using PHP.  In other words, I want to replace the "prior_status" with whatever the "current_status" is, so I can then change all the "current_status" entries to inactive and thus have a club membership status history.  I'm sorta at a loss here, for several reasons:

 

1. I'm not sure how many db entries I could have.  I could have just 5 lines, or I could have 50.  I'd like the PHP code to loop until it finds no more db entries.

 

2.  I know how to SELECT or UPDATE an entry, but it seems here that I need to do both simultaneously.  Can I do that, or do I need some sort of array?

 

I successfully did this a few years back, but I misplaced that file, and I can't for the life of me remember how I did it.  Any help would be greatly appreciated!!!

Link to comment
https://forums.phpfreaks.com/topic/188426-php-code-to-transcribe-mysql-fields/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.