mypopy Posted February 27, 2007 Share Posted February 27, 2007 Hi everyone I've got this error Error: (1064) You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'sobi2Listing_field_country'> how do I use preg_replace to remove sobi2Listing and leave field_country only. Thanks Link to comment https://forums.phpfreaks.com/topic/40352-preg_replace/ Share on other sites More sharing options...
obsidian Posted February 27, 2007 Share Posted February 27, 2007 Hi everyone I've got this error Error: (1064) You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'sobi2Listing_field_country'> how do I use preg_replace to remove sobi2Listing and leave field_country only. Thanks If you're doing a straight replace like that, I would recommend you use str_replace(): <?php $query = str_replace('sobi2Listing_', '', $query); ?> If you need to do a more detailed pattern match, preg_replace would be the way to go: <?php $query = preg_replace('|sobi2Listing_|', '', $query); ?> Good luck Link to comment https://forums.phpfreaks.com/topic/40352-preg_replace/#findComment-195248 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.