Content Top
DAL Computer Help » Web Design, Development & Marketing » Web Development Help » PHP Help » Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING in /home/patriot/publ

Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING in /home/patriot/publ


HEY! You're not logged in which is fine if you simply want to browse for answers, however if you want to post your own Questions and hangout here you need to Register! ...Registration takes 2 minutes and is completely free. If you have already registered simply log in using the form to the right.

Reply
Thread Tools
PHP Help
Old 23-02-2005, 07:26 AM   #1 (permalink)
Tech Rank 3/5
 
patriotcow's Avatar
 
Status: BANNED
Join Date: Nov 2004
Posts: 533
 patriotcow Is a beginner here at D-A-L



patriotcow is offline  
Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING in /home/patriot/publ

I am having a problem with a piece of code anyone see any problems in this code, it basically submits the data into the database.

PHP Code:
 <?php
 
require_once("./connect.php");
 
?>
 <form action="<?php echo $_server['PHP_SELF']; ?> method="post">
 <label>Insert news here:<br />
 <textarea mame="newstext" rows="10" cols="40">
 </textarea></label><br />
 <input type="submit" value="SUBMIT" />
 </form>
 <?php
 
if (isset($_POST['newstext'])) {
 
$newstext $_POST[newstest]';
 $sql = "INSERT INTO news SET
 newstext='
$newstext',
 if (@mysql_query($sql)) {
 ecbo '
<p>News had been submitted</p>';
 } else {
 echo '
<p>Error adding news' .
 mysql_error() . '
</p>;
 }
 }
 
?>


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Advertisement - Register to remove Ads its free!

Old 23-02-2005, 09:44 AM   #2 (permalink)
 
D-A-L's Avatar
 
Status: D-A-L Administrator
Join Date: Apr 2004
Posts: 3,081
 D-A-L is beginning to become part of the furnitureD-A-L is beginning to become part of the furnitureD-A-L is beginning to become part of the furnitureD-A-L is beginning to become part of the furnitureD-A-L is beginning to become part of the furnitureD-A-L is beginning to become part of the furnitureD-A-L is beginning to become part of the furnitureD-A-L is beginning to become part of the furnitureD-A-L is beginning to become part of the furnitureD-A-L is beginning to become part of the furnitureD-A-L is beginning to become part of the furniture



D-A-L is offline  
Re: Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING in /home/patriot/publ

Did the error have a line number?

This line looks like it needs closing...sure it's correct?

Code:
$sql = "INSERT INTO news SET
__________________
D-A-L

Please help support this Free Computer Help Service - Make A Donation


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 23-02-2005, 10:34 AM   #3 (permalink)
Tech Rank 3/5
 
patriotcow's Avatar
 
Status: BANNED
Join Date: Nov 2004
Posts: 533
 patriotcow Is a beginner here at D-A-L



patriotcow is offline  
Re: Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING in /home/patriot/

Ive done it now, vbulletinstudio.com its just that simple thing on the side but has alot to be done yet
In the end I ended up with a nicer smaller code, done by me I feel proud lol.
PHP Code:
 <?php
 
 
require_once("./connect.php");
 
$result = @mysql_query('SELECT newstext FROM news');
 if (!
result) {
 exit(
'<p>Error performing fetch from database: ' mysql_error () . '</p>');
 }
 
 while (
$row mysql_fetch_array($result)) {
 echo 
'<p>' $row['newstext'] . '</p>';
 }
 
 
?>


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 24-02-2005, 11:21 AM   #4 (permalink)
Tech Rank 3/5
 
patriotcow's Avatar
 
Status: BANNED
Join Date: Nov 2004
Posts: 533
 patriotcow Is a beginner here at D-A-L



patriotcow is offline  
Re: Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING in /home/patriot/

added a function to stop html being processed, stupid people adding redirects taking over my sites

quite good: $newstext = htmlspecialchars($newstext);


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools

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 On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Parse error koryusai kun PHP Help 1 27-07-2006 05:16 PM


All times are GMT +1. The time now is 07:58 AM.

Bottom Corner