NEWS SHOW
<?php
include('../includes/config.inc.php');
@mssql_select_db($AccountDB);
$getnews = @mssql_query("SELECT TOP 5* FROM [NEWS_TBL] order by id desc");
while($fetchnews = @mssql_fetch_array($getnews))
{
echo "<b>" .$fetchnews['title'];
echo "</b><br />";
echo $fetchnews['message'];
echo "<br />";
echo "<i><font size='1.5'>Posted on: " .$fetchnews['date'];
echo " By: ".$fetchnews['postedby'];
echo "</i></font size><br /><br /><br />";
}
?>
NEWS EXECUTE
<?php
echo "<center>";
echo "<form method='post'>";
echo "Message Title: <input type='text' name='title' maxlength='40'><br>";
echo "Message: <textarea cols='30' rows='8' name='message' maxlength='200' wrap=virtual></textarea><br>";
echo "<input type='submit' value='Submit' name='submit'><br>";
if(isset($_POST['submit'])) {
include('../includes/config.inc.php');
if(@$_SESSION['Account2'])
{
@mssql_select_db($AccountDB);
$title = $_POST['title'];
$message = $_POST['message'];
$postedby = $_SESSION['Account2'];
$v_date = date("l d F H:i:s");
$insert = @mssql_query("INSERT INTO [NEWS_TBL] (title, message, date, postedby) VALUES ('$title', '$message', '{$v_date}', '{$postedby}')");
if($insert) {
echo 'Your news thread has been posted successfully!';
} else
{
echo 'Error inputting news.';
}
}
}
?>
Probably someone is gonna say to indent your code, but I just don't indent, sorry.
Anyway, I run a script in which when you input text into a text box, it'll go into the database, as well as your session name.
The problem is that it WILL ALWAYS record the information in MSSQL, but it will never echo it out on the news. Any help?