Solved

ereg_replace error issue

Posted on 2011-09-14
2
297 Views
Last Modified: 2012-05-12
Hello,

I am getting this error:
Deprecated: Function ereg_replace() is deprecated in /var/ww...

with this line of code:
mysql_real_escape_string(ereg_replace("([0-9](-| |.))?(\(?[0-9]{3}\)?(-| |.)?)?[0-9]{3}(-| |.)?[0-9]{4}", "", $row['description']))

Open in new window


I tried to replace ereg_replace with preg_replace but I am getting this error:

Warning: preg_replace() [function.preg-replace]: Unknown modifier '?' in /va...
0
Comment
Question by:movieprodw
2 Comments
 
LVL 30

Accepted Solution

by:
Marco Gasi earned 500 total points
ID: 36536650
Use preg_replace instead (http://it2.php.net/preg_replace):

mysql_real_escape_string(preg_replace("#([0-9](-| |.))?(\(?[0-9]{3}\)?(-| |.)?)?[0-9]{3}(-| |.)?[0-9]{4}#", "", $row['description']))
0
 
LVL 1

Author Closing Comment

by:movieprodw
ID: 36536665
Thank you
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
In Solr 4.0 it is possible to atomically (or partially) update individual fields in a document. This article will show the operations possible for atomic updating as well as setting up your Solr instance to be able to perform the actions. One major …
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

759 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

25 Experts available now in Live!

Get 1:1 Help Now