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.
i would ~not~ use multiple tables for multiple users
use only one single table, and declare indexes properly so that all your queries are optimized
millions of rows are not "too cumbersome and difficuilt to control"