Jump to content


Photo

help with update query


  • Please log in to reply
2 replies to this topic

#1 john_6767

john_6767
  • Members
  • PipPipPip
  • Advanced Member
  • 99 posts

Posted 18 August 2006 - 06:25 AM

i have a database that has " in some of the names of the fields and i am trying to write some sql to update these fields by replacing " with the word 'inch'. How would i go about doing this? php is having trouble with the "...

#2 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 18 August 2006 - 11:36 AM

In the names of the fields, or the data in the fields?

Trivial example below works:
<?php
$old = 'This is a six" nail';
$new = str_replace('"',' inch',$old);
echo $new;
?>

Legend has it that reading the manual never killed anyone.
My site

#3 fenway

fenway
  • Staff Alumni
  • MySQL Si-Fu / PHP Resident Alien
  • 16,199 posts
  • LocationToronto, ON

Posted 18 August 2006 - 04:09 PM

MySQL has a replace function as well.
Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users