Quote:
Originally Posted by Publisher Bucks
So I know that I can call information from the SQL database and output it and replace certain words using the REPLACE string but, how would I go about replacing everything in a specific column with a word, or set of words, without actually removing that columns data?
How do I replace whatever is in that 'pets' column with the word 'zombie' no matter if its dog, fish, cat, porcupine, etc? There are a bunch of different variations of 'pet'.
Is there something like REPLACE_ALL I can use across the column or can I only replace certain substring occurrences?
[quickedit]
Also, does it matter if the string is numeric or alphanumeric too as far as the command goes?
|
You are overthinking it, I think. You do not need to do a replace.
Just select the string you want.
Select 'zombie' as petname, other field, otherfield, etc. from pets where whatever.
That way you get the data from the record but instead of the name you get zombie.
But you can also do that when you print out the data.
Select * from pets.
While($row=...)
{
echo 'Pet name: Zombie' . ' ' . $row['pet_price'] . ' ' . whetever other data you want
}
I think that is what it sound like you are trying to do.
.