I want to replace something like this:
$sql = "CREATE TABLE bas_table ( )";
With this:
"CREATE TABLE hugo_table ( )";
And do the same for INSERT INTO... How do i do this?
If you know that "bas_" will not appear within your data, then a simple str_replace() will do.
$new_data = str_replace('bas_','dummy_',$old_data);
If you're not sure, then a regular expression or more inclusive str_replace() would be necessary.
$new_data = str_replace('CREATE TABLE bas','CREATE TABLE dummy',$old_data);
or
$new_data = preg_replace('^CREATE TABLE bas','CREATE TABLE dummy',$old_data);
-- ---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
php|architect: The Magazine for PHP Professionals – www.phparch.com
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php