Results 1 to 2 of 2
Jun 29, 2011, 04:39 #1
- Join Date
- May 2011
- 0 Post(s)
- 0 Thread(s)
mysql how to create a dynamic table
i have a problem that I am unable to resolve myself. I am building a jobs board for members to be able to communicate with each other. I anticipate that members will send out and receive a lot of correspondence between each other via the site. So i obviously need to have a database to store their communications with each other.
My questions are
What is the best way to approach this?
- Do I dynamically create individuals table for each members ( i suspect this is the right approach).
- Or simple table for all the members ( i suspect that such a table will be too cumbersome and difficult to control in the long run. It would end up with millions of emails) .
I tried to dynamically create a table for each member.
The title for the dynamic table is member ( plus a concatenating of the $user_Id ( thus creating a unique table for each indivudial ). However when i tried to run it to the database, the mysql database did not create the tables. i have no idea where i have gone wrong with the SQL syntax. could someone please look at my SQL query and tell me if its correct.
Thank you in advance for your kind help.
require_once ('databaseb_functions.php'); // Connect to the database.
$sqlCommand = "USE jobs;
CREATE TABLE members.'$id (
user_id int(11) NOT NULL ,
foreign_id int(11) NOT NULL ,
messages_sent varchar(255) NOT NULL,
date_sent varchar(255) NOT NULL,
message_received DATETIME NOT NULL,
date_received DATETIME NOT NULL,
$SqlCommand = mysqli_query ($dbc, $sqlCommand); // Run the query.
Jun 29, 2011, 16:54 #2
- Join Date
- Jul 2002
- Toronto, Canada
- 49 Post(s)
- 1 Thread(s)