LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
LinkBack Search this Thread
Old 01-29-2007, 11:40 AM   #1
coffee245
LQ Newbie
 
Registered: Jan 2007
Posts: 2

Rep: Reputation: 0
need help with "Parse error: parse error, unexpected T_STRING"


I am very new to the world of programming, and am in the process of teaching myself code. I'm not entirely sure if this is the right place to ask, but here goes (I think it's a pretty simple question, I just don't know the answer)...

This is the code I'm working on (with PHP, and all sensitive password info removed):

<html>
<head>

<title>Bangladesh - Add Indicators</title>

</head>

<body>

<?php // THIS SCRIPT ADDS INDICATORS TO THE BANGLADESH PAGE

//ERROR HANDLING

ini_set ('display_errors', 1);
error_reporting (E_ALL & ~E_NOTICE);

if (isset ($_POST['submit'])) { // HANDLE THE FORM

// CONNECT AND SELECT
if ($dbc = @mysql_connect
('xxxxxxxxxxxx', 'xxxx', 'xxx'))

{

if (!@mysql_select_db ('jcoonro_programs'))
{
die ('<p>Could not select the database because: <b>' .
mysql_error() . '</b></p>');

}

} else {
die ('<p>Could not connect to MySQL because: <b>' .
mysql_error() . '</b></p>');
}

// DEFINE THE QUERY

$query = "INSERT INTO bg_indicator
(bg_ind_id, bg_indicator)
VALUES (1, '{$_POST['bg_indicator']}');

// EXECUTE THE QUERY

if (@mysql_query ($query)) {
print '<p> The new indicator has been added. </p>';
} else {
print '<p>Unable to add the indicator because: <b>' . mysql_error() .
'</b>. The query was $query.</p>';

}

mysql_close();

}

?>

<form action="bg_add_indicator.php" method="post">

<p>Indicator: <input type="text" name="bg_indicator" size="40" maxsize="100" /></p>

<input type="submit" name="submit" value="Add Indicator" />

</form>
</body>
</html>


That there is the code. I am receiving the error message:

parse error: parse error, unexpected T_STRING in /hsphere/local/home/jcoonrod/end-hunger.info/thpud/bg_add_indicator.php on line 59

in which line 59 is: <form action="bg_add_indicator.php" method="post">


Is this just an html problem? If so, I can't figure out what I did incorrectly. I am generally being driven crazy, and any help would be appreciated.
 
Old 01-29-2007, 11:44 AM   #2
paulsm4
Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,858
Blog Entries: 1

Rep: Reputation: Disabled
Hi -

I don't see where you ever close this PHP string:
Code:
$query = "INSERT INTO bg_indicator
(bg_ind_id, bg_indicator)
VALUES (1, '{$_POST['bg_indicator']}');... // Where's the ending (")?
 
Old 01-29-2007, 11:53 AM   #3
coffee245
LQ Newbie
 
Registered: Jan 2007
Posts: 2

Original Poster
Rep: Reputation: 0
YOU WERE EXACTLY RIGHT!! Fixing that fixed everything. Thank goodness for your keen eyesight.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
What's the meaning of "PHP Parse error: parse error, unexpected $ in..." frandalla Programming 23 03-04-2009 12:34 PM
"Parse error" from class_postbit.php loading thread PTrenholme LQ Suggestions & Feedback 2 12-08-2005 11:26 AM
stdio.h parse error before "__gnuc_va_list" Warnken Red Hat 1 02-10-2004 11:24 AM
kernel 2.6.0 compliation problems: "parse error before 'va_list'" sohmc Linux - General 6 12-21-2003 04:45 AM
Newbie: "Parse Error" when adding wireless usb network adapter tommer Red Hat 7 10-16-2003 04:48 PM


All times are GMT -5. The time now is 02:35 PM.

Main Menu
 
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration