Possible to add same data to ALL tables?

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
thefreebielife
Forum Contributor
Posts: 126
Joined: Thu Apr 26, 2007 2:59 pm

Possible to add same data to ALL tables?

Post by thefreebielife »

Here is my table structure:

Code: Select all

  `uId` int(6) NOT NULL auto_increment,
  `username` text NOT NULL,
  `password` text NOT NULL,
  `fname` text NOT NULL,
  `phone` text NOT NULL,
  `email` text NOT NULL,
  `address` text NOT NULL,
  `city` text NOT NULL,
  `state` text NOT NULL,
  `zip` text NOT NULL,
  `country` text NOT NULL,
  `ip` text NOT NULL,
  `gid` int(6) NOT NULL default '0',
  `rid` int(6) NOT NULL default '0',
  `ostatus` double NOT NULL default '0',
  `holdreason` text NOT NULL,
  `astatus` tinyint(4) NOT NULL default '0',
  `date` text NOT NULL,
  `deadline` text NOT NULL,
  `dead` tinyint(4) NOT NULL default '0',
  `istatus` tinyint(4) NOT NULL default '0',
  `denyreason` text NOT NULL,
  `rollo` int(6) NOT NULL default '0',
  `site` varchar(10) NOT NULL default 'Cash',
  PRIMARY KEY  (`uId`)
) ENGINE=MyISAM AUTO_INCREMENT=72104 DEFAULT CHARSET=latin1 AUTO_INCREMENT=72104 ;
Is it possible to get all the current tables to have "site" as "Cash"?

If so, how?

Thanks,
Jared
User avatar
VladSun
DevNet Master
Posts: 4313
Joined: Wed Jun 27, 2007 9:44 am
Location: Sofia, Bulgaria

Post by VladSun »

All tables? I do see only one ...

Code: Select all

update `table` set `site`="Cash"
There are 10 types of people in this world, those who understand binary and those who don't
User avatar
califdon
Jack of Zircons
Posts: 4484
Joined: Thu Nov 09, 2006 8:30 pm
Location: California, USA

Post by califdon »

Let me guess: did you mean to say "all records in the table"? The Default parameter for a field in a table is only effective for NEW records added. What do you want to do? Are there records in the table already? What values, if any, are in the "site" field? Do you want to replace them? All of them? If so, that's what VladSun showed you how to do.
Post Reply