RE: [PHP] How do i replace table names?

This is a discussion on RE: [PHP] How do i replace table names? within the PHP General forums, part of the PHP Programming Forums category; [snip] No, i mean to replace the names in the string... And then execute them... [snip] *slaps forehead* Duh, just ...


Go Back   Usenet Forums > PHP Programming Forums > PHP General

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 11-03-2003
Jay Blanchard
 
Posts: n/a
Default RE: [PHP] How do i replace table names?

[snip]
No, i mean to replace the names in the string... And then execute
them...
[snip]

*slaps forehead* Duh, just do it?

$sqlCreateTable = "CREATE TABLE `dumBas` ( ";
$sqlCreateTable .= "`ai` int(11) NOT NULL AUTO_INCREMENT, ";
$sqlCreateTable .= "`thing` char(32) default NULL, ";
$sqlCreateTable .= "`stuff` char(16) default NULL, ";
$sqlCreateTable .= "PRIMARY KEY (`ai`), ";
$sqlCreateTable .= "KEY `thing` (`thing`) ";
$sqlCreateTable .= ") ";
$dbCreateTable = mysql_query($sqlCreateTable, $connectionStuff);
Reply With Quote
  #2 (permalink)  
Old 11-03-2003
Bas
 
Posts: n/a
Default Re: [PHP] How do i replace table names?

OKAY, I WANT TO REPLACE IN THE TABLENAME THE TEXT BAS_ WITH DUMMY_

SUCH LIKE THAT "CREATE TABLE BAS_DATA" BECOMES "CREATE TABLE DUMMY_DATA"

I AM NOT THAT DUMB... I JUST WANT TO REPLACE 1 TABLE PREFIX BY ANOTHER!!!


"Jay Blanchard" <jay.blanchard@niicommunications.com> wrote in message
news:C8F323573C030A448F3E5A2B6FE2070B01AFA9F9@neme sis...
[snip]
No, i mean to replace the names in the string... And then execute
them...
[snip]

*slaps forehead* Duh, just do it?

$sqlCreateTable = "CREATE TABLE `dumBas` ( ";
$sqlCreateTable .= "`ai` int(11) NOT NULL AUTO_INCREMENT, ";
$sqlCreateTable .= "`thing` char(32) default NULL, ";
$sqlCreateTable .= "`stuff` char(16) default NULL, ";
$sqlCreateTable .= "PRIMARY KEY (`ai`), ";
$sqlCreateTable .= "KEY `thing` (`thing`) ";
$sqlCreateTable .= ") ";
$dbCreateTable = mysql_query($sqlCreateTable, $connectionStuff);
Reply With Quote
  #3 (permalink)  
Old 11-03-2003
Zhuravlev Alexander
 
Posts: n/a
Default Re: [PHP] How do i replace table names?

On Mon, Nov 03, 2003 at 04:37:41PM +0100, Bas wrote:
> OKAY, I WANT TO REPLACE IN THE TABLENAME THE TEXT BAS_ WITH DUMMY_
>
> SUCH LIKE THAT "CREATE TABLE BAS_DATA" BECOMES "CREATE TABLE DUMMY_DATA"
>
> I AM NOT THAT DUMB... I JUST WANT TO REPLACE 1 TABLE PREFIX BY ANOTHER!!!


sed -i.bak -e s'/BAS_/DUMMY_/g' your_sql_file.sql


-- zhuravlev alexander
u l s t u n o c
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 08:36 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0