Linux Help
guides forums blogs
Home Desktops Distributions ISO Images Logos Newbies Reviews Software Support & Resources Linuxhelp Wiki

Welcome Guest ( Log In | Register )



Advanced DNS Management
New ZoneEdit. New Managment.

FREE DNS Is Back

Sign Up Now
 
Reply to this topicStart new topic
> Parse Error On Web Page, PHP MYSQL Parse Error Web Page
jetpacmidge
post May 11 2005, 07:24 AM
Post #1


Whats this Lie-nix Thing?
*

Group: Members
Posts: 4
Joined: 10-May 05
Member No.: 4,979



Hi

I am new to using PHP and MYSQL and am having trouble with a page which I keep on getting a Parse Error on the last line of the script ????

This is the error message that I get when I try to load up the web page :-

Parse error: parse error in srv/www/htdocs/Tadburn/results2.php on line 134.

Line 134 is the last line of the script.

The page is a form which the administrator fills in for entering football results filling in the form either by a pull down menu or fill in the box

Below is a copy of the script :-

<?php
/* Program: results2.php
* Desc: Allows the Administrator to enter the football
* results which updates the tables.
*/
?>
<HTML>

<HEAD>

<TITLE>Results</TITLE>
<STYLE>
<!--
A {text-decoration: none; color:#00008B}
-->
</STYLE>
</HEAD>

<BODY BGCOLOR="FAFAD2" TEXT="00008B" LINK="00008B" VLINK="00008B" ALINK="00008B">
<?php
$user="root";
$host="localhost";
$password="";
$database = "Tadburnfc";

$connection = mysql_connect($host,$user,$password)
or die ("couldn't connect to server");
$db = mysql_select_db($database,$connection)
or die ("Couldn't select database");

echo "<form action='AddResult.php' method='post'>n";

echo "<center>n";
echo " <b><font face='Arial, Helvetica, sans-serif' size='+3' color='#0000FF'>Results</font></b>n";
echo "</center>n";
echo "<br>n";
echo "<br>n";
echo "<font face='Arial, Helvetica, sans-serif' size='+1' color='#0000FF'>n";
echo "<p>Enter the football score on the form below !!</p>n";
echo "<br>n";
echo "<br>n";

echo "<font face='Arial, Helvetica, sans-serif' color='#0000FF'>n";

echo "<table border='0'> n";
echo "<tr><td align='right'>Season :</td>n";
echo "<td><input type='text' name='season'
value='$season'
size='7' maxlength='7'> (enter season as 2003/04)</td>n";

echo " <tr><td align='right'>Fixture Date :</td>n";
echo " <td><input type='text' name='fixtureDate'
value='$fixtureDate'
size='12' maxlength='12'> (enter date as 2003-mm-dd)</td>n";
echo " </tr> n";
echo " <tr><td align='right'>Age Group :</td>n";

$query = "SELECT DISTINCT age FROM leagueTable ORDER BY age";
$result = mysql_query($query)
or die ("Couldn't execute query.");

echo "<select name='age'>n";

while ($row = mysql_fetch_array($result))
{
echo "<tr>n";
extract($row);

echo "<td><option value='$age'></td>$agen";

echo " </tr>n";
echo " <tr><td align='right'>Division or League :</td>n";

$query = "SELECT DISTINCT division FROM leagueTable ORDER BY division";
$result = mysql_query($query)
or die ("Couldn't execute query.");

echo "<select name='division'>n";

while ($row = mysql_fetch_array($result))
{
extract($row);
echo "<td><option value='$division'></td>$divisionn";
}
echo "</select>n";
echo "</tr>n";

echo " <tr><td align='right'>Home Team :</td>n";
$query = "SELECT DISTINCT homeTeam FROM leagueTable ORDER BY homeTeam";
$result = mysql_query($query)
or die ("Couldn't execute query.");

echo "<select name='homeTeam'>n";

while ($row = mysql_fetch_array($result))
{
extract($row);
echo "<td><option value='$homeTeam'><td>$homeTeamn";
}
echo "</select>n";
echo "</tr>n";
echo "<tr><td align='right'>Home Score :</td>n";
echo " <td><input type='text' name='homeScore'
value='$homeScore' size='3' maxlength='3'>n";

echo "<tr><td align='right'>Away Team :</td>n";
$query = "SELECT DISTINCT awayTeam FROM leagueTable ORDER BY awayTeam";
$result = mysql_query($query)
or die ("Couldn't execute query.");

echo "<select name='homeTeam'>n";

while ($row = mysql_fetch_array($result))
{
extract($row);
echo "<option value='$awayTeam'>$awayTeamn";
}
echo "</select>n";
echo "</tr>n";

echo " <tr><td align='right'>Away Score :</td>n";
echo " <td><input type='text' name='awayScore'
value='$awayScore' size='3' maxlength='3'>n";

echo "</table>n";
echo "</font>n";

echo "<p><input type='submit' value='Submit Result'>
<input type='submit' name='newbutton' value='Cancel'>
</form>n";
?>

</body>
</html>

Any help to resolve my problem would be much appreciated.

Thanks.

Rgds,
Go to the top of the page
 
+Quote Post
michaelk
post May 11 2005, 11:54 AM
Post #2


Its GNU/Linuxhelp.net
*******

Group: Support Specialist
Posts: 1,800
Joined: 23-January 03
Member No.: 360



Is this an exact copy of your script? I've found lots of errors.
Make sure all variables have a $
There are several instances of the following
value='$season'

In addition make sure there is a ; and the end of each php line.

If the n at the end of the lines is supposed to be a newline character then it should be a n. I see it on some lines where it isn't required.

I found several of these errors too:
echo " <td><input type='text' name='awayScore' "; <--needs

Go back and look at each line in your script for errors.
Go to the top of the page
 
+Quote Post
DS2K3
post May 11 2005, 01:40 PM
Post #3


Its GNU/Linuxhelp.net
*******

Group: Support Specialist
Posts: 1,284
Joined: 14-November 04
From: Southampton, Hampshire
Member No.: 4,165



Open the script in an editor like bluefish, or even kwrite (if you use KDE). They provide syntax highlighting which will help you find problems.

Parse errors on the last line can be cuased by not closing all logic blocks (ie missing a } or endif; )

D


--------------------
Fixed your problem? Let us know!
richard@linuxhelp.net

www.Gathr.co.uk Online Event Management
Go to the top of the page
 
+Quote Post
chrisw
post May 12 2005, 07:00 AM
Post #4


RMS is my Hero
******

Group: Admin
Posts: 634
Joined: 27-September 02
From: Louisiana
Member No.: 5



yes ds2k3 is correct

you are missing the closing } for the first while statement in the program


--------------------

Chris W.
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 13th December 2017 - 11:32 PM