Current location: Hot Scripts Forums » Programming Languages » PHP » Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE | help?

Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE | help?

Reply
  #1 (permalink)  
Old 11-25-04, 11:02 AM
culticka culticka is offline
Newbie Coder
 
Join Date: Oct 2004
Posts: 35
Thanks: 0
Thanked 0 Times in 0 Posts
Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE | help?

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 .
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Share on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 11-25-04, 03:10 PM
<?Wille?> <?Wille?> is offline
Junior Code Guru
 
Join Date: Jan 2004
Location: Helsinki, Finland
Posts: 666
Thanks: 0
Thanked 0 Times in 0 Posts
there was prittey mutch there to talk about.. i wont guaratee any success with this eather but it should work better then your code
PHP Code:
<?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='".$_SERVER['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>"
;
?>
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Share on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
parse error, unexpected T_STRING jozin PHP 4 01-19-05 04:57 AM
please help with parse error Mister B. PHP 10 09-11-04 11:30 AM
Parse Error Help, PLEASE!! mrgis PHP 1 05-23-04 05:15 AM
parse error help fraggle PHP 3 04-21-04 03:49 PM
[php error] parse error | fatal error xeoHosting PHP 1 01-03-04 08:12 PM


All times are GMT -5. The time now is 11:40 AM.
vBulletin® Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.