Jump to content

[SOLVED] Table Names from Strings


kingnutter

Recommended Posts

Hi everyone,

 

I'm just getting back into php/mysql after a few months so apologies if I'm a bit rusty.

 

I am putting together a site which allows users to create their own pages with all data stored in their own table(s).

 

My question is, is it possible for the tables to be meaningfully named by the user e.g. generate a Mysql query within a php page along the lines of:

 

CREATE TABLE $userCreatedTitle_data...

 

I do hope this makes sense!

 

Any help appreciated,

 

Gary

 

 

Link to comment
Share on other sites

Possible? Yes. Good idea? Probably not because users may choose a name that already exists (and destroy part of your site), or use illegal character combinations, or choose a MySQL reserved word as a table name.  Up to you, though.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.