Re: How do i replace table names?
| From: | John W. Holmes | Date: | Mon, 03 Nov 2003 17:00:31 +0000 |
| Subject: | Re: How do i replace table names? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-168401@lists.php.net to get a copy of this message | ||
Bas wrote:
I want to replace something like this: $sql = "CREATE TABLE bas_table (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)";With this: "CREATE TABLE hugo_table ( )"; And do the same for INSERT INTO... How do i do this?