SitePoint Sponsor |
|
User Tag List
Results 1 to 5 of 5
-
Jun 26, 2002, 08:53 #1
- Join Date
- Apr 2002
- Posts
- 37
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
find/replace text in database field?
I have a form field in one of my tables and need to replace some text within it for all the entries.
Example of what is in my form field
<FORM METHOD=POST ACTION="http://www.?????">
<INPUT TYPE=HIDDEN NAME=??? VALUE="???">
<INPUT TYPE=HIDDEN NAME=??? VALUE="???">
<INPUT TYPE=HIDDEN NAME=??? VALUE="???">
</FORM>
What i want to do is replace the http://www.????? with something else. Is there a find/replace feature to run through my form field in my table and only replace the selected part i want changed with something else?
Thanks for any help.Last edited by bigjohn5; Jun 26, 2002 at 09:57.
-
Jun 26, 2002, 12:32 #2
- Join Date
- Apr 2002
- Posts
- 37
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
While i figured it out. So if anyone wants to know how to replace a part of something in a field here it is.
UPDATE table name SET field name = REPLACE (field name , 'part of field you want replaced ', 'what you want inserted in it's place ');
-
Jun 26, 2002, 13:26 #3
- Join Date
- May 2002
- Posts
- 90
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
bigjohn5,
That update query looks really weird to me, but I'm sure it works for you try this and see if it's a little easier
mysql_query ("Update table
set field='what you want here'
");
-
Jun 27, 2002, 07:51 #4
- Join Date
- Apr 2002
- Posts
- 37
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
The thing is i only want part of the field replaced, not the whole field. So the query above would replace the whole field and not just a selected portion of it like i need. I have no clue if the way i did it is the best way, but it worked. If anyone has a better way or sees a reason why the way i did it could screw things up please let me know.
Thanks
-
Jun 27, 2002, 12:22 #5
Moved to a more appropriate forum - not a PHP question!
SeanHarry Potter
-- You lived inside my world so softly
-- Protected only by the kindness of your nature
Bookmarks