I have the code below:
<?php
$con = mysql_connect("localhost","will","blahblahblah");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("bombom", $con);
$sql="INSERT INTO links (link, notes)
VALUES
('$_POST[link]','$_POST[notes]')";
if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
echo "1 record added";
mysql_close($con)
?>
This adds a new record to the table in my database. I will be handling multiple users with this database, should each user have their own table or just their own record?
I was thinking just their own record but how would I code it so that it creates two new columns for everyone link and notes submitted from the form and add to their record?
You’ve got a fundamental misunderstanding of how database tables go. You don’t create a column or table for each user. You create one table for all users, and have a method to uniquely identify which user the row belongs to.
Then, to find any one user’s links, you’d do