| | |
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
Views: 627 | Replies: 3
| 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 directory display download dynamic echo email error file files folder form forms function functions google href htaccess html image include insert integration ip java javascript joomla jquery limit link login loop mail memmory menu methods mlm mod_rewrite multiple mysql oop parse paypal pdf php problem query radio random recursion regex remote script search select send server sessions sms soap source space speed sql static structure syntax system table tutorial up-to-date update updates upload url validation validator variable video web wordpress xml youtube






