| | |
Alter many files, all with same variable in them
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
I have 100's of files that access a field in a mySQL DataBase. I had to change the field name and now I have to update 100's of files. The files read:
I need it to now read:
I know I could go through all files and execute a replace 'user_id' with 'id', but that would take forever. Does anyone know a program to do this easier?
PHP Syntax (Toggle Plain Text)
$sql = 'SELECT user_id, username, user_colour, user_birthday FROM '
PHP Syntax (Toggle Plain Text)
$sql = 'SELECT id, nick, user_colour, user_birthday FROM '
I know I could go through all files and execute a replace 'user_id' with 'id', but that would take forever. Does anyone know a program to do this easier?
Last edited by woocha; Jan 17th, 2008 at 11:04 am.
Off the top of my head, Dreamweaver has a search and replace (CTRL-F) function that will allow you to batch replace an entire folder/website/etc.
While you are finding and replacing, you might consider replacing 100 instances of the same code with an include path to a single script to make future revisions less painful.
While you are finding and replacing, you might consider replacing 100 instances of the same code with an include path to a single script to make future revisions less painful.
If you're on linux then grep is your friend. Also as Johnsquibb said, if you have probably over 5 instances of identical code, put it in one file then just include it.
GCS d- s+ a-->? C++(++++) UL+++ P+>+++ L+++ E--- W+++
N+ o K w++(---) O? !M- V PS+>++ PE+ Y+ PGP !t- 5? X- R tv+
b+>++ DI+ D G++>+++ e+ h+>++ r y+
PMs asking for help will not be answered, post on the forums. That's what they're there for.
N+ o K w++(---) O? !M- V PS+>++ PE+ Y+ PGP !t- 5? X- R tv+
b+>++ DI+ D G++>+++ e+ h+>++ r y+
PMs asking for help will not be answered, post on the forums. That's what they're there for.
•
•
•
•
Off the top of my head, Dreamweaver has a search and replace (CTRL-F) function that will allow you to batch replace an entire folder/website/etc.
While you are finding and replacing, you might consider replacing 100 instances of the same code with an include path to a single script to make future revisions less painful.
![]() |
Similar Threads
- Tutorial: Automating Office applications (Visual Basic 4 / 5 / 6)
- TXT file split routine (Visual Basic 4 / 5 / 6)
Other Threads in the PHP Forum
- Previous Thread: without using input type=file can we upload the file
- Next Thread: Help! Parse error: parse error, unexpected T_STRING
| Thread Tools | Search this Thread |
.htaccess ajax alerts apache api array autocomplete beginner binary broken cakephp checkbox class cms code convert cron curl database date display dynamic echo email emptydisplayvalue error errors file files folder form forms function functions google hack href htaccess html htmlspecialchars image include insert integration ip java javascript joomla limit link login loop mail menu methods mlm mod_rewrite multiple mysql network object oop paypal pdf php problem query radio random recursion recursive redirect regex remote script search securephp server sessions shot sms soap source space sql subscription syntax system table tutorial update upload url validation validator variable video web xml youtube






