Jump to content

[SOLVED] Mysql with $userId?


Jam87

Recommended Posts

Hi all,

 

I'm pretty new, relatively speaking, to php and mysql and have been trying for several days now to create a mysql table for every user upon visiting a certain page. In the past i've used flatfiles so its been pretty easy to define a file with the user_id php session variable. But now i need a similar system for mysql and dont have a clue where or what to replace the variable with.

 

I've looked all over the web and cant seem to find any reference to creating a mysql table for each user, being named after their unique userId.

 

I hope i've explained this well enough, and it makes some sense :)

 

Thanks in advance to anyone who helps

 

Jam87

Link to comment
Share on other sites

Ok, quick update, i've managed to get the databases created properly using my sites unique user Id variable, all i need to do now is read from those defined tables.

 

the session variable is $userId

 

the connect code is:

 

$conf['dbtable_ab']    = '$userId_book';

$conf['dbtable_cat']    = '$userId_cat';

$conf['dbtable_catmap'] = '$userId_catmap';

 

the above doesnt work, but i'm sure its down to my bad coding rather than limitation

 

thanks again :)

Link to comment
Share on other sites

to create a mysql table for every user upon visiting a certain page.

 

Why on earth would you want a separate database for each user? You might want to find yourself some tutorials on database design. There is a link in my signiture to a free book, within that book is an entire section on working with databases in php. it might get you started. Especially the section on normalization.

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.