#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2000
    Location
    Norcross, GA
    Posts
    458
    Rep Power
    15
    What generally causes php to return a parse error on a line that doesn't exist? The error is said to occur on the line after the last true document line.

    Ie, there are 50 lines of actual html/php code. Page displays like I want, save this error at the very bottom:

    "Parse error in mydoc.php3 on line 51"

    Any ideas?
  2. #2
  3. .Net Developer
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2000
    Location
    London
    Posts
    987
    Rep Power
    15
    mstembri,
    look around the last line of your code.check it out wether you have closed all the "}".

    post the code here.we can help you to find out the error.



    ------------------
    SR -
    webshiju.com
    www.jobxyz.com-IT Career Portal
    ezipindia.com--WebStudio


    "The fear of the LORD is the beginning of knowledge..."
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2000
    Posts
    51
    Rep Power
    15
    hi,

    ive had this error from time to time, and it drives me nuts. it could stem from a number of problems:
    1. are you using an include within the script? if so, those lines _will_ be figured into the code in which the error is appearing, causing an otherwise strange line number.
    2. your text editor. you may have inserted an otherwise invisible character into the script that is making it go bonkers.
    3. do you have a line 51? if so, check out the lines preceding it. sometimes errors propogate a bit before being reported, particularly misplaced commas, semicolons, and the like.

    Of course, you want to get rid of the error. However, if you're sure that the script is executing correctly and are in an absolute hurry to get it up, you can suppress the php error reporting at the top of the script. i can remember offhand how to do so, but its in the docs.

    good luck,
    wj


  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2000
    Location
    Norcross, GA
    Posts
    458
    Rep Power
    15
    Let me add.

    The php script contains an include statement:

    <?php include('spec.inc.php3'); ?>

    This particular inc contains php script to print a specification table. The spec.inc works fine by itself.

    When the include is commented out, there are no errors. Likewise when the include points to another .inc file with no php code at all, there are no parse errors.
  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2000
    Location
    Norcross, GA
    Posts
    458
    Rep Power
    15
    http://www.georgiaoffroad.com/bike5.php3?model=88kx500 - url with include 'hard coded'. This one produces the error I mentioned above.


    Here's another version:
    http://www.georgiaoffroad.com/bike2.php3?model=88kx500

    That script tests for a variable and will either include or ignoer the inc file. In theory, anyway. In reality it prints the spec table twice and bungles the html table. And produces the strange parse error.

    Here's the code:

    <?php include("header.inc"); ?>
    <tr bgcolor="#A6A772" height="100%">
    <td></td></tr>
    </table></td>
    <td width="2" align="left" valign="top" bgcolor="3d3c21"></td>
    <td width="623" valign="top" align="center"><!-- Begin Dirt Bike Guide -->

    <?php
    $db = mysql_connect("localhost","xxxxxx","xxxxxx");

    mysql_select_db("gor",$db);

    $result = mysql_query("SELECT * FROM spec WHERE model='$model'",$db);
    ?>

    <table cellspacing="0" cellpadding="0" border="0" align="center">
    <tr><td height="10" colspan="5"></td></tr>
    <tr>
    <td valign="top" colspan="5" align="center"><p class="bold2">
    <?php
    while ($myrow = mysql_fetch_array($result)) {
    printf("%s", $myrow['modelfull']);
    }
    mysql_data_seek($result,0);
    ?> &nbsp;&nbsp;<a href="#rev">Rider reviews</a></td></tr>

    <tr><td height="10" colspan="5"></td></tr>
    <tr>
    <td align="center" colspan="5">
    <?php
    while ($myrow = mysql_fetch_array($result)) {
    if(!$myrow['imagepath']){
    echo "<img src="Miscellaneous/nophoto.jpg"</td></tr>nn";
    } else {
    echo "<img src="";
    printf("%s", $myrow['imagepath']);
    echo ""></td></tr>nn";
    }
    }
    mysql_data_seek($result,0);
    ?>
    <tr><td height="15" colspan="5"></td></tr></table>


    <table cellspacing="0" cellpadding="3" border="0" align="center">

    <?php

    // CHECK FOR EXISTENCE OF SPECIFICATION DATA
    // IF 'Y' OR 'y', INCLUDE SPEC TABLE, OTHERWISE CLOSE THE TABLE AND CONTINUE

    while ($myrow = mysql_fetch_array($result)) {

    if($myrow['specs'] == "Y" &#0124; &#0124;$myrow['specs'] == "y"){

    include("spec.inc");

    } else {

    echo "<tr>n <td colspan=5 height=20></td></tr></table>nn";

    }

    }
    ?>


    <table cellspacing="0" cellpadding="0" border="0" align="center">
    <tr>
    <td width="5"></td>
    <td valign="top" width="150"><p class="bold1"><a name="rev">Rider</a> reviews:</td>
    <td valign="top"><p class="bold1">
    <?php
    echo "<a href="review.php3?model=";
    echo $model;
    echo "">Review this motorcycle!</a></td></tr>";
    ?>
    <tr><td height="10" colspan="3"></td></tr>
    </table>

    <table cellspacing="0" cellpadding="2" border="0" align="center">


    <?php
    $db = mysql_connect("localhost","xxxxxxx","xxxxxx");

    mysql_select_db("gor",$db);

    $result = mysql_query("SELECT * FROM review WHERE model='$model'",$db);

    while ($myrow = mysql_fetch_array($result)) {

    echo "<tr>n";
    echo " <td width=5></td>n";
    echo " <td width=100 valign="top"><p class="bold">Name:</td>n";
    echo " <td width="350"><p>n";
    printf("%s", $myrow['name']);
    echo "</td></tr>nn";

    echo "<tr>n";
    echo " <td width=5></td>n";
    echo " <td width=100 valign="top"><p class="bold">Email:</td>n";
    echo " <td width="350"><p><a href="mailto:";
    printf("%s", $myrow['email']);
    echo "?subject=Your dirt bike review on Georgia Off Road">Permitted</a></td></tr>nn";

    echo "<tr>";
    echo " <td width=5></td>n";
    echo " <td width=100 valign="top"><p class="bold">Power:</td>n";
    echo " <td width="350"><p>";
    printf("%s", $myrow['power']);
    echo "</td></tr>nn";

    echo "<tr>n";
    echo " <td width=5></td>n";
    echo " <td width=100 valign="top"><p class="bold">Suspension:</td>n";
    echo " <td width="350"><p>";
    printf("%s", $myrow['susp']);
    echo "</td></tr>nn";

    echo "<tr>n";
    echo " <td width=5></td>n";
    echo " <td width=100 valign="top"><p class="bold">Handling:</td>n";
    echo " <td width="350"><p>";
    printf("%s", $myrow['handling']);
    echo "</td></tr>nn";

    echo "<tr>n";
    echo " <td width=5></td>n";
    echo " <td width=100 valign="top"><p class="bold">Brakes:</td>n";
    echo " <td width="350"><p>";
    printf("%s", $myrow['brakes']);
    echo "</td></tr>nn";

    echo "<tr>n";
    echo " <td width=5></td>n";
    echo " <td width=100 valign="top"><p class="bold">Reliability:</td>n";
    echo " <td width="350"><p>";
    printf("%s", $myrow['reliable']);
    echo "</td></tr>nn";

    echo "<tr>n";
    echo " <td width=5></td>n";
    echo " <td width=100 valign="top"><p class="bold">Comments:</td>n";
    echo " <td width="350"><p>";
    printf("%s", $myrow['comments']);
    echo "</td></tr>nn";

    echo "<tr>n";
    echo " <td width=5></td>n";
    echo " <td width=100 valign="top"><p class="bold">Overall rating:</td>n";
    echo " <td width="350"><p class="bold">";
    printf("%s", $myrow['rating']);
    echo "</td></tr>nn";

    echo "<tr><td colspan=3 height=15></td></tr>nn";

    }
    ?>

    </table><!-- End Dirt Bike Guide -->
    </td>
    <?php include("footer.inc"); ?>
  10. #6
  11. .Net Developer
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2000
    Location
    London
    Posts
    987
    Rep Power
    15

    <<
    if($myrow['specs'] == "Y" | |$myrow['specs'] == "y"){
    >>


    mstembri,
    i noticed you have missed a space after above 'or' condition operator.i don't know wether that will create any problem or not.

    any way just check it out that..

    if($myrow['specs'] == "Y" &#0124; &#0124; $myrow['specs'] == "y"){

    ------------------
    SR -
    webshiju.com
    www.jobxyz.com-IT Career Portal
    ezipindia.com--WebStudio


    "The fear of the LORD is the beginning of knowledge..."



    [This message has been edited by Shiju Rajan (edited August 21, 2000).]

Similar Threads

  1. Relative Path
    By MrT in forum Apache Development
    Replies: 2
    Last Post: February 12th, 2004, 07:05 AM
  2. Codepupil
    By Adachic in forum C Programming
    Replies: 3
    Last Post: February 6th, 2004, 07:50 PM
  3. Opening file, finding line, then inserting new line
    By mach5 in forum Perl Programming
    Replies: 2
    Last Post: February 5th, 2004, 12:00 AM
  4. Upload script parse errors
    By irishairpics in forum PHP Development
    Replies: 7
    Last Post: January 15th, 2004, 01:50 PM
  5. parse integer data to a 3D array
    By daedalus8530 in forum Java Help
    Replies: 2
    Last Post: December 2nd, 2003, 11:19 AM

IMN logo majestic logo threadwatch logo seochat tools logo