We help IT Professionals succeed at work.
Get Started

Replace tick mark with "star" in PHP

Bill Sullivan
Last Modified: 2013-12-12
Hi Experts, I'm trying to replace a tick mark in a variable with a "star" before sending it to my MySQL table (if I leave the tick mark in, MySQL assumes the field to close).  When I use preg_replace, I get the following error:

Warning: preg_replace() [function.preg-replace]: No ending delimiter ''' found in /Library/WebServer/Documents/TransferRawData.php on line 144

The table does update, but the field that is to be updated with the variable is blank (all other fields update properly).

Here is the PHP command I use to replace the tick mark with a star:

$Misc4Desc = preg_replace("'","*",$Misc4Desc);

Any help will be greatly appreciated!
Watch Question
This problem has been solved!
Unlock 1 Answer and 4 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE