Gossamer Forum
Home : General : Perl Programming :

Annoying....parse error...

Quote Reply
Annoying....parse error...
Well, this is really annoying me! I have been working on this for ages, but can not seem to find any reason why I'm getting the following error;

Quote:
Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING' in c:\program files\nusphere\apache\nsdocs\test\acemailing\emails.php on line 316

The code I am using is;

Code:
function list_emails() {

global $sql_username, $sql_password, $sql_host, $sql_database, $debug;

echo <<<TOP_HTML

<html>

<head>
<meta http-equiv="Content-Language" content="en-gb">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>New Page 1</title>
</head>

<body>

<p align="center"><b><font face="Verdana" size="4">List All Emails</font></b></p>
<p align="center"><font face="Verdana" size="2">Please complete the form below
to delete an email.</font></p>
<p align="center">&nbsp;</p>
<form method="POST">
<input type="hidden" name="do" value="add2">
</form>

<div align="center">
<center>
<table border="0" cellpadding="0" cellspacing="0" width="100%" id="AutoNumber1" fpstyle="9,011111100" style="border-left-style: none; border-right-style: none; border-top-style: none; border-bottom: 1.5pt solid black; background-color: silver">
<tr>
<td width="25%" style="font-weight: bold; color: white; border-left-style: none; border-right-style: none; border-top-style: none; border-bottom: 1.5pt solid black; background-color: maroon">
<p align="center"><font face="Arial">Name</font></td>
<td width="25%" style="font-weight: bold; color: white; border-left-style: none; border-right-style: none; border-top-style: none; border-bottom: 1.5pt solid black; background-color: maroon">
<p align="center"><font face="Arial">Email</font></td>
<td width="25%" style="font-weight: bold; color: white; border-left-style: none; border-right-style: none; border-top-style: none; border-bottom: 1.5pt solid black; background-color: maroon">
<p align="center"><font face="Arial">Subscription Type</font></td>
<td width="25%" style="font-weight: bold; color: white; border-left-style: none; border-right-style: none; border-top-style: none; border-bottom: 1.5pt solid black; background-color: maroon">
<p align="center"><font face="Arial">Options</font></td>
</tr>


TOP_HTML;

// set up the connection
$connection = mysql_connect("$sql_host", "$sql_username", "$sql_password");
if (!$connection) { error("Unable to connect with your login info for MySQL", $connection); }

// connect the database
$db = mysql_select_db("$sql_database", $connection);
if (!$db) { error("Unable to execute command", $connection); }

// run the query to get all the email addresses
$query = "SELECT * FROM Ace_Mailing";
$result = mysql_query($query); if (!$result) { $error = mysql_error(); error("Unable to get email list!...Reason: $error", $connection); }
mysql_query($query);
while ($row = mysql_fetch_array ($result)) {
// find out who the author is...

echo "<tr>";
echo "<td width='25%' style='font-weight: bold; color: black; border-style: none; background-color: #FFFFEF'>";
//echo "<p align='center'>" . $row["PersonName"] . "</td>";
echo "<td width='25%' style='color: black; border-style: none; background-color: #FFFFEF'>";
//echo "<p align='center'>" . $row["PersonEmail"] . "</td>";
echo "<td width='25%' style='color: black; border-style: none; background-color: #FFFFEF'>";
//echo "<p align="center">" . $row["SendHTML"] . "</td>";
echo "<td width='25%' style='color: black; border-style: none; background-color: #FFFFEF'>";
echo "<p align='center'>";
//echo "<a href='email.php?do=delete2&email=" . $row["PersonEmail"] . "'>Remove</a></td>";
echo "</tr>";


} // end the while

return $table_show;

mysql_close($connection);



echo <<<END_HTML

<tr>
<td width="25%" style="font-weight: bold; color: black; border-style: none; background-color: #FFFFEF">
<p align="center">&nbsp;</td>
<td width="25%" style="color: black; border-style: none; background-color: #FFFFEF">
<p align="center">&nbsp;</td>
<td width="25%" style="color: black; border-style: none; background-color: #FFFFEF">
<p align="center">&nbsp;</td>
<td width="25%" style="color: black; border-style: none; background-color: #FFFFEF">
<p align="center">&nbsp;</td>
</tr>
</table>
</center>
</div>

</body>

END_HTML;



}

Anyone got any ideas?

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [AndyNewby] Annoying....parse error... In reply to
Anyone? Unimpressed

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [AndyNewby] Annoying....parse error... In reply to
talk about impatient Tongue
Quote Reply
Re: [AndyNewby] Annoying....parse error... In reply to
Tell us what line 316 is.... that might help....

Ivan
-----
Iyengar Yoga Resources / GT Plugins
Quote Reply
Re: [yogi] Annoying....parse error... In reply to
This is line 316;

Code:
//echo "<p align='center'>" . $row["PersonName"] . "</td>";

That is why I'm so confused. To verify it was the problem I commented it out, but for some reason it is still giving an error! Is there a way to get more indepth errors in PHP?

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [AndyNewby] Annoying....parse error... In reply to
>>I commented it out, but for some reason it is still giving an error!<<

Um does that not tell you something?
Quote Reply
Re: [RedRum] Annoying....parse error... In reply to
Er, thats why I'm wondering what is going on! Wink

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [RedRum] Annoying....parse error... In reply to
Right, I've narrowed it down to this block of code;

Code:
echo <<<TOPHTML

<html>

<head>
<meta http-equiv="Content-Language" content="en-gb">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>New Page 1</title>
</head>

<body>

<p align="center"><b><font face="Verdana" size="4">List All Emails</font></b></p>
<p align="center"><font face="Verdana" size="2">Please complete the form below
to delete an email.</font></p>
<p align="center">&nbsp;</p>
<form method="POST">
<input type="hidden" name="do" value="add2">
</form>

<div align="center">
<center>
<table border="0" cellpadding="0" cellspacing="0" width="100%" id="AutoNumber1" fpstyle="9,011111100" style="border-left-style: none; border-right-style: none; border-top-style: none; border-bottom: 1.5pt solid black; background-color: silver">
<tr>
<td width="25%" style="font-weight: bold; color: white; border-left-style: none; border-right-style: none; border-top-style: none; border-bottom: 1.5pt solid black; background-color: maroon">
<p align="center"><font face="Arial">Name</font></td>
<td width="25%" style="font-weight: bold; color: white; border-left-style: none; border-right-style: none; border-top-style: none; border-bottom: 1.5pt solid black; background-color: maroon">
<p align="center"><font face="Arial">Email</font></td>
<td width="25%" style="font-weight: bold; color: white; border-left-style: none; border-right-style: none; border-top-style: none; border-bottom: 1.5pt solid black; background-color: maroon">
<p align="center"><font face="Arial">Subscription Type</font></td>
<td width="25%" style="font-weight: bold; color: white; border-left-style: none; border-right-style: none; border-top-style: none; border-bottom: 1.5pt solid black; background-color: maroon">
<p align="center"><font face="Arial">Options</font></td>
</tr>


TOPHTML;

What I did was block comment it out, and it seemed to work (obviously not printing out what was in the above code snippet).

Can anyone see anything really obviously wrong with it ? Frown

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [AndyNewby] Annoying....parse error... In reply to
Odd, removing the space before TOPHTML; seems to have fixed it! Very weird. Is this a bug, and is it known about? I'm on v4.0.6.

Thanks

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [AndyNewby] Annoying....parse error... In reply to
http://www.php.net/...tring.syntax.heredoc

Read the "Warning" thing....

Ivan
-----
Iyengar Yoga Resources / GT Plugins
Quote Reply
Re: [yogi] Annoying....parse error... In reply to
Ah..thats a real bummer. You would have thouht they could find a way around something as annoying as that Tongue

Thanks for that though, I'l have to remember that for the future.

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [AndyNewby] Annoying....parse error... In reply to
It's the same deal for HEREDOCS in Perl... so I assume there is no easy/logical/better way to do it.

--Philip
Links 2.0 moderator
Quote Reply
Re: [King Junko II] Annoying....parse error... In reply to
Ah well, gotta be greatful the do offer so much in a web-based programming language. Not like we have to pay 100's of $$$'s for it is it Wink

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [AndyNewby] Annoying....parse error... In reply to
I was gonna start another thread for this, but I decided against it Wink I've got a really weird problem now with PHP!
I've got a REALLY weird thing! For some reason, when executing this code PHP CRASHES! I'm on Win 98 with PHP 4.0.6 (upgrading soon). It says the error was a 'stack' problem. Mean anything to anyone? :-|

The code is;

Code:
<?php

if ($action == "install") { do_install(); } else { show_setup(); }

######################################## */

function show_setup() {

echo <<<TEMPLATE

<html>

<head>
<meta http-equiv="Content-Language" content="en-gb">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Install</title>
</head>

<body>

<font FACE="Arial" size="2"><b>
<p align="center">Install Script</p>
</b>
<p align="center">This script will set up the tables and some sample data in
your desired MySQL database. Please complete the form below and click on
'Continue'. </p>
<form method="POST">
<p align="center">SQL Host :
<input type="text" size="20" name="sql_host" value="localhost"></p>
<p align="center">SQL Database :
<input type="text" size="20" name="sql_database"></p>
<p align="center">SQL Username :
<input type="text" size="20" name="sql_username"></p>
<p align="center">SQL Password :&nbsp;
<input type="text" size="20" name="sql_password"></p>
<p align="center"><input type="submit" value="Continue" name="B1"></p>
<input type="hidden" name="action" value="install">
</form>
</font>

</body>

</html>


TEMPLATE;

}


/* ######################################## */

function do_install() {

global $sql_host, $sql_username, $sql_password, $sql_database;

// connect to mySQL and if not pass back an error
$connection = mysql_connect($sql_host, $sql_username, $sql_password); $error = mysql_error();
if (!$connection) { sql_error_report("Unable to connect with your login info for MySQL. Reason: $error", $connection); }
if ($debug) { echo "Host connection established....<BR>"; } //a little something for debugging

// now we need to connect the database
$db = mysql_select_db($sql_database, $connection); $error = mysql_error();
if (!$db) { sql_error_report("Unable to connect to database. Reason: $error", $connection); }
if ($debug) { echo "Database connection established....<BR>"; } // a little debugging info if needed...

// run the query to update the 'sales' column...
$query = <<<QUERY

DROP TABLE IF EXISTS Ace_Mailing;
CREATE TABLE Ace_Mailing (
SetID int(11) NOT NULL auto_increment,
PersonName text NOT NULL,
PersonEmail text NOT NULL,
SendHTML text NOT NULL,
UNIQUE KEY SetID (SetID)
) TYPE=MyISAM;

#
# Dumping data for table `Ace_Mailing`
#

INSERT INTO Ace_Mailing VALUES (1,'Test Person','webmaster@test.com.inc','html');
INSERT INTO Ace_Mailing VALUES (2,'Test Person Again','webmaster@somewhere.com.inc','html');

QUERY;

$result = mysql_query($query); $error = mysql_error();
if (!$result) { error("Unable to execute query to setup database tables! Reason: $error", $connection); }

mysql_close($connection); // exit the connection so we dont clog up MySQL

echo "MySQL Data seems to have been installed successfully. Now edit settings.inc.php (or do it via the admin panel) and set up the MySQL info there. Then you can login at admin.php with admin/1234.";


} // end function for redirect page.

/* ######################################## */


// hopefully catch those nasty errors!
function error($error) {

$template_read = @file("errortemplate.htm");

if (!$template_read) { error("Unable to read tempalte file. Please double check it is there."); }

foreach ($template_read as $line) {

// do some preg_matches to replace the tags...
$return = ereg_replace("::ERROR::", "$error", $line);

echo $return;

} // end the foreach

exit;

}

/* ######################################## */

// error sub in case we get problems with SQL queries etc.
function sql_error_report($error, $connection) {

echo $error;
mysql_close($connection); // exit the connection so we dont clog up MySQL
exit; // exit from the script...we can't do anything now...

}

?>

Thanks for any help you can offer.

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [AndyNewby] Annoying....parse error... In reply to
Mmm, restarting my computer 'seems' to have fixed that now. For some reason now though my SQL query wont work!

This is the custom error I got reported back;

Quote:
Unable to execute query to setup database tables! Reason: You have an error in your SQL syntax near '; CREATE TABLE Ace_Mailing (SetID int(11) NOT NULL auto_increment,PersonName ' at line 1.

Query:

DROP TABLE IF EXISTS Ace_Mailing; CREATE TABLE Ace_Mailing (SetID int(11) NOT NULL auto_increment,PersonName text NOT NULL,PersonEmail text NOT NULL,SendHTML text NOT NULL,UNIQUE KEY SetID (SetID)) TYPE=MyISAM; INSERT INTO Ace_Mailing VALUES (1,'Test Person','webmaster@test.com.inc','html'); INSERT INTO Ace_Mailing VALUES (2,'Test Person Again','webmaster@somewhere.com.inc','html');

Anyone got any ideas? The format looks ok to me Unimpressed

Thanks, and I know I'm probably getting annoying now...lol

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [AndyNewby] Annoying....parse error... In reply to
Anyone?

This is getting really annoying....as I have just got the installer to complete and then i can release the script. I know I could just give instructions on how to do it via MyPHPAdmin/MySQLMan or SSH/Telnet, but I would far prefer to have an installer for it.

Anyone got any ideas? i've attached the installer file install.php to this thread if anyone is interested in having a look.

Thanks

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!

Last edited by:

AndyNewby: Mar 8, 2002, 2:34 AM
Quote Reply
Re: [AndyNewby] Annoying....parse error... In reply to
Never mind...I eventually work out the last load of errors.

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!