Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

asp to create mysql table with user input

Status
Not open for further replies.

suseli

Technical User
Dec 9, 2005
77
0
0
GB
Hi i have a mysql database named "dbgallery".

Is there anyway that i can create a html form where user can enter the name of the table and click submit to create the table with that name in the dbgallery database.
 
Assuming that your database connection account has DDL privileges, you can construct a CREATE TABLE statement, using the user's input as the table name. As always, be sure to use CFQUERYPARAM in your statement construction.

Look up CREATE TABLE in your DB's docs for the syntax.

Phil Hegedusich
Senior Programmer/Analyst
IIMAK
-----------
I'll have the roast duck with the mango salsa.
 
YEESH. Forget the CFQUERYPARAM piece (I have ColdFusion on the brain). The intent is to make sure that you avoid SQL statement injection.

Happy New Year!

Phil Hegedusich
Senior Programmer/Analyst
IIMAK
-----------
I'll have the roast duck with the mango salsa.
 
Im quite newbie in asp,

Will be very grateful if u can post the scripts here please.
 
You construct and call a CREATE TABLE statement the same way that you would issue a SELECT statement.

See for the syntax.

Better still, create a MySQL stored procedure that accepts the user table name as a parameter. Call the stored procedure in your ASP code.

For an example of how to use ASP to create a table, go to


Also, see and for more ASP examples.

Good luck!

Phil Hegedusich
Senior Programmer/Analyst
IIMAK
-----------
I'll have the roast duck with the mango salsa.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top