Good people, I have the following code:
<?php
require('../members/inc/config.php');
require('../lib/framework.php');
$author = $_SESSION['username'];
if(!empty($_POST['news_title']) || !empty($_POST['news_message']))
{
if(!empty($_POST['news_title']) && !empty($_POST['news_message']))
{
$date = date( 'jS F Y' );
$time = date( 'H:i' );
$query = "INSERT INTO news (id, author, title, text, date, time) VALUES('', '".$author."', '".$_POST['news_title']."', '".$_POST['news_message']."', '".$date."', '".$time."')" or die(mysql_error());
$insert = mysql_query($query) or die(mysql_error());
echo '<p>Successful News Update “'.$_POST['news_title'].'”';
}
else
{
echo '<p>Please fill in all fields</p>';
}
}
?>
The question is: I have two tables in the same database, q "news" and "members". I want to insert this in the session already started in "members" But it says that it does not know the row "username" and it exists ..
Notice: Undefined index: username
Edit: Already, could you help me pass this on to PDO? : ss