Posted by Ace on 01/24/06 07:04
Ok here is probably a stupid question - however for the life of me I
cannot find a simple way to do it! here is the scenario
I have a MySQL database that has a TEXT field with information in it!
- Typically a sentence or two describing objects!
I have written a php script that needs to add a self generated string
to the text! - The text field would say something like this
Great looking "statue" worth $5.00 'only'
I would bring in that string as $current_notes
What my script does is it reads the content of that field in as a
string - then adds the date to it and needs to write it back to the
database!
All goes well - until the text has a " or a ' in the text - how can I
write a php msql update command that would work I.E
$new_notes="$current_notes - Sold to $customer on $formateddate";
$query ="UPDATE `goods` SET `goods_notes` = '$new_notes' WHERE
`object_id` = $object_id LIMIT 1" ;
of course if my combined string has a " or a ' in it then the mysql
command blow out! if it does not! then it works! (I have a work
around at the moment that simply strips all the " and ' out of the
text field! - this is obviously not the way to do it!
Any help would much be appreciated
Navigation:
[Reply to this message]
|