Hello,
I'm new php, and have a question that has me a bit confused,
I'm trying to create a new script that would display,
Topic: Title
Body: This is where the body of the news.
Date: Date the news posted
Posted By: The authors username
I have everything working except the authors username,
So what I did is create two tables:
User Table:
ID
Username
Password
E-Mail
News Table:
ID
Topic
Body
Date
PostedBy
I want to create an association between Posted by => Username (from the user table), basically want it so that the posted by would have the username of the person who actually did the posting.
How do I create a relationship between the news & user table?
This is the query I'm using to select,
$query = mysql_query("SELECT topic, body, date, postedby
FROM news
This is what using to insert,
$query = mysql_query("INSERT INTO news (topic, body, date)
VALUES ('$topic', '$body', 'datepost()')");
My idea is to use a form to post news, so how do I make it so when I post it also inserts the username or userid of the person posting?
Thank you