/    Sign up×
Community /Pin to ProfileBookmark

mysql and php building tables

1)can i build tables at run time from php?
2) can i add and remove after it col’s from my table?
thanks in advance
peleg

to post a comment
PHP

7 Comments(s)

Copy linkTweet thisAlerts:
@pyroDec 02.2003 — Yes and yes... ?
Copy linkTweet thisAlerts:
@pelegk1authorDec 03.2003 — yes isnt not an answer!?
Copy linkTweet thisAlerts:
@pyroDec 03.2003 — Actually, it is a perfect answer to your questions. ?

Anyway, for 1, a sample would look something like this:

[code=php]CREATE TABLE tablename (
id int(11) NOT NULL auto_increment,
name varchar(50) NOT NULL,
PRIMARY KEY (id)
);[/code]


For two, something like this would add a new column named newcol, that is a VARCHAR field with a length of 50:

[code=php]ALTER TABLE tablename ADD newcol VARCHAR(50) NOT NULL;[/code]

And to drop the same column:

[code=php]ALTER TABLE test DROP test;[/code]
Copy linkTweet thisAlerts:
@Paul_JrDec 04.2003 — Pyro, he said "isn't not", which is a double negative -- meaning he said it is an answer... unless he made a typo...
Copy linkTweet thisAlerts:
@pyroDec 04.2003 — ?
Copy linkTweet thisAlerts:
@Paul_JrDec 04.2003 — :eek: Now I'm totally and officially confused...
×

Success!

Help @pelegk1 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.16,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...