Is there a way to automatically create a table with a tablename that is taken from a field the user has previously entered (i.e. username).
I have tried :

$sql = 'CREATE TABLE $username (....)'; and
$sql = 'CREATE TABLE '$username' (....)';

but neither work.

Any ideas??

Thanks

Yarni

    If only I could I need it automated i'm afraid.

    Every new user that registers will need their own unique table.

      Use double quotes.

      $query = "CREATE TABLE $tablename..."

      Using single quotes doesn't parse variable, doubles do.

      BTW, making a table for each user doesn't sound like the best practice... You'd probably be better off having one table with a user_id column. Or a separate database for each user if you're worried about permissions.

        Write a Reply...