Hi, i’m playing around with a simple posting script and I can get into posted into the database, I have created a login system, but I can figure out how to insert the username into the “author” field for when a record is added.
I’m not even sure of the exact terminology to google to research it, so any help would be much appreciated.
The best answer I’ve been able to find is below, but it isn’t working for me, everything else posts to the database but the author.
[php]<?php include(“includes/config.php”);
session_start();
$_SESSION[‘username’] = $result->username;
$category = $_POST[‘category’];
$topic = $_POST[‘topic’];
$postdate = $_POST[‘postdate’];
mysql_query(“INSERT INTO topics (category, topic, author, postdate) VALUES (’$category’,’$topic’,’{$_SESSION[‘username’]}’,now())”);
?>[/php]