Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in [filename] on line 48
here's the code:
Quote:
<?php
// Configuration variables
$dbname = "db";
$dbusername = "user";
$dbpasswd = "pass";
$dbhost = "host";
$table = "table";
$connection = mysql_pconnect("$dbhost","$dbusername","$dbpasswd" )
or die ("Couldn't connect to server.");
mysql_select_db("$dbname", $connection)
or die("Couldn't select database.");
?>
<?
// the form
echo "<form action='<? PHP_SELF ?>' method='post'>
<input type='hidden' name='newsid' value='<?=$newsid?>'>
<input type='text' value='name' name='author'><br>
<input type='text' value='email' name='email'><br>
<input type='text' value='title' name='title'><br>
<textarea cols='18' rows='12' name='full'>story</textarea><br>
<input type='text' value='password' name='password'>
<input type='submit' value='go' name='submit'>";
?>
<?
$ipaddress = getenv(REMOTE_ADDR);
?>
<?
$date = date("l M d, Y");
$process = $_REQUEST['process'];
$module = $_REQUEST['module'];
if($process == "submit")
{
$name = "$_POST['author']";
$email = "$_POST['email']";
$title = "$_POST['title']";
$story = "$_POST['story']";
$password = "$_POST['password']";
if($title == "" || $story == "" || $author == "" || $password="")
{
$msg = "one of the label is empty<br>";
$module = "post_topic";
echo = "$msg<br>$module";
}
if($password == "098727")
{
$sql = "insert into news set title = '$title', full = '$story', author = '$author', date = '$date'";
$result = "mysql_query($sql)";
or die("unable to get result");
$msg_p = "<script language=JavaScript>window.location.replace('index .php')</script>";
}
}
?>
<?
// displays news
$news_id = mysql_query ("SELECT * FROM news WHERE id=$newsid LIMIT 1");
$news_title = mysql_query ("SELECT * FROM news WHERE title=$title");
$news_author = mysql_query ("SELECT * FROM news WHERE author=$author");
$news_story = mysql_query ("SELECT * FROM news WHERE full=$story");
$news_date = mysql_query ("SELECT * FROM news WHERE date=$date");
echo "<link rel='stylesheet' href='style.css' type='text/css'>
<table border='0' width='275' cellpadding='0' cellspacing='0'>
<tr>
<td width='275' background='images/topic_top.gif' align='left' valign='middle'>
<font size='2'>
<b>
$news_title - $news_author
</b>
</font>
</td>
</tr>
<tr>
<td width='275' bgcolor='c0c0c0' style='border-left: 1px solid #000000; border-right: 1px solid #000000;' align='left' valign='top'>
<font size='2'>
$news_story
</font>
</td>
</tr>
<tr>
<td width='275' background='images/topic_bottom.gif' align='right' valign='middle'>
<font size='2'>
<b>
$news_date
</b>
</font>
</td>
</tr>
</table>";
?>
|
any help or suggestions would be appreciated. also, is there any other easier way to display the news?
Quote:
<?
// displays news
$news_id = mysql_query ("SELECT * FROM news WHERE id=$newsid LIMIT 1");
$news_title = mysql_query ("SELECT * FROM news WHERE title=$title");
$news_author = mysql_query ("SELECT * FROM news WHERE author=$author");
$news_story = mysql_query ("SELECT * FROM news WHERE full=$story");
$news_date = mysql_query ("SELECT * FROM news WHERE date=$date");
echo "<link rel='stylesheet' href='style.css' type='text/css'>
<table border='0' width='275' cellpadding='0' cellspacing='0'>
<tr>
<td width='275' background='images/topic_top.gif' align='left' valign='middle'>
<font size='2'>
<b>
$news_title - $news_author
</b>
</font>
</td>
</tr>
<tr>
<td width='275' bgcolor='c0c0c0' style='border-left: 1px solid #000000; border-right: 1px solid #000000;' align='left' valign='top'>
<font size='2'>
$news_story
</font>
</td>
</tr>
<tr>
<td width='275' background='images/topic_bottom.gif' align='right' valign='middle'>
<font size='2'>
<b>
$news_date
</b>
</font>
</td>
</tr>
</table>";
?>
|
thanks

.