Forum Moderators: open
I'm having trouble with this little script here..
I have a referer db, and basicly I'm tired of seeing so many versions and subversions of the same browsers, that it really ticks me of.
So:
I'm trying to replace all instances of lets say Firefox 1.***.. to Firefox 1. Lets say instead of Opera 9.21 - just Opera 9.
So here's what I tried:
UPDATE visitors SET browser = replace( browser, 'Firefox 1.', 'Firefox 1' );
The problem is, that it doesn't change the entire string. It just changes the 'Firefox 1.' to 'Firefox 1', but leaving all the other numbers and dots unchanged.
Is there a PHP or MySQL way to make a change to the entire cell?
So
UPDATE visitors SET browser = 'Firefox 1' where browser like 'Firefox 1.%'
The % is a wildcard so it has to start with 'Firefox 1.' but it can be anything after the .
Before you execute it though do a select to make sure it is return all the rows you would want to change. Just to be safe.
So
select browser from visitors where browser like 'Firefox 1.%'