Hi, after days of figuring this out, i still have no idea of whats wrong with the code..
Hopefully you guys could help me out..

when i put this code on my home.php file, i keep getting this error :

Parse error: syntax error, unexpected $end in C:\xampp\htdocs\smartforum\home.php on line 348

this is the code that i meant :

<ul id="wall">
          <?php
           include('insert.php');
           $test=mysql_query("SELECT*FROM wall ORDER BY id DESC");
                	
              while($row=mysql_fetch_array($test)){
                echo "<li class='stbody'><div class='stimg'></div><div class='sttext'>".
                      $row["message"].
                      
                     "<div class='below'><div class='sttime'>2 seconds ago</div>
		      <div class='help-toggle'>| Help |</div>
		      <div class='trigger_default'><a href='#'>Discuss</a></div>
		      <div class='toggle_container_default'>
       
	              <ul class='reply_text'>
                         <!--This is where i try to execute the second query
                          where the comment for each wall post appear--> ";
                         ?> <?php include(get_reply.php); ?><?
                echo "      </ul>
		       
   <div class='block'>
      <form name='disscuss_text' id='post_reply' id='post_reply'>
        <textarea rows='3' cols='87' id='discuss_text' name='discuss_text'></textarea>
        <input type='submit' value='Post' name='Help' id='post-button' />
      </form>
   </div>
		</div>
	        </div>	
	        </li>";
		
                }
                ?>
            </ul>

help me please...

Thank You :)

Dani AI

Generated

A few focused notes that add to the answers from and and help avoid this class of syntax problems in the future.

Most of these "unexpected end" syntax problems come from an unclosed construct (missing }, ), ], a quoted string, a heredoc/nowdoc block, or an unterminated PHP tag in either the main file or any included file. Follow a quick isolation workflow: enable full error reporting, run the PHP linter on the main file and on each included file, and then reintroduce includes one at a time until the error reappears. That narrows the offending file quickly.

Useful checks and commands:

<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
?>
php -l yourpage.php
php -l included-file.php

Practical tips: use an editor with bracket/quote matching and syntax highlighting; temporarily comment out or rename include() targets to see if the problem goes away; avoid building very large HTML blocks inside quoted echoes (close PHP and emit HTML instead, as suggested by ); watch for unclosed block comments (/ /) and disabled short tags (use full <?php ?>). Treat include filenames as strings (quote them) and test each file separately with the linter. Following these steps will find the exact missing token and make the fix straightforward.

Recommended Answers

All 4 Replies

The problem is with ur included pages.
It the missing of closing braces on functions or loops.
Checkout the included pages.

The problem is with ur included pages.
It the missing of closing braces on functions or loops.
Checkout the included pages.

hi there,thanks for answering,
and here the included pages code:

<?php
include("config.php");
$test3=mysql_query("SELECT*FROM reply");

while($row3=mysql_fetch_array($test3)){
	echo $row3['message'].'<br/>';
}

?>

and here is the config.php file:

<?php
// Change this parameter with your connection's info.
$db_host="localhost";
$db_name="******";
$username="*****";
$password="*****";
$db_con=mysql_connect($db_host,$username,$password);
$connection_string=mysql_select_db($db_name);
// Connection
mysql_connect($db_host,$username,$password);
mysql_select_db($db_name);
?>

i do not see anything wrong here with my codes,,please tell me if you see something..
thank you...

Member Avatar for Member #120589

You've included a lot of html within the php tags. How about...

<ul id="wall">
                     <?php
                     include('insert.php');
                     $test=mysql_query("SELECT*FROM wall ORDER BY id DESC");
                     while($row=mysql_fetch_array($test)){
                     ?>     
                     <li class='stbody'>
                        <div class='stimg'>
                        </div>
                        <div class='sttext'>
                           <?php echo $row["message"];?>
                           <div class='below'>
                               <div class='sttime'>
                                   2 seconds ago
                               </div>
		               <div class='help-toggle'>
                                   | Help |
                               </div>
		               <div class='trigger_default'>
                                   <a href='#'>Discuss</a>
                               </div>
		               <div class='toggle_container_default'>
                                  <ul class='reply_text'>
                                      <?php include('get_reply.php');?>
                                  </ul>
                               <div class='block'>
                                  <form name='disscuss_text' id='post_reply' id='post_reply'>
                                     <textarea rows='3' cols='87' id='discuss_text' name='discuss_text'></textarea>
                                     <input type='submit' value='Post' name='Help' id='post-button' />
                                  </form>
                               </div>
		           </div>
	               </div>	
	           </li>
                   <?php 
                   }
                   ?>
               </ul>

Can't see any unclosed braces. Check your include files for unclosed braces.

You've included a lot of html within the php tags. How about...

<ul id="wall">
                     <?php
                     include('insert.php');
                     $test=mysql_query("SELECT*FROM wall ORDER BY id DESC");
                     while($row=mysql_fetch_array($test)){
                     ?>     
                     <li class='stbody'>
                        <div class='stimg'>
                        </div>
                        <div class='sttext'>
                           <?php echo $row["message"];?>
                           <div class='below'>
                               <div class='sttime'>
                                   2 seconds ago
                               </div>
		               <div class='help-toggle'>
                                   | Help |
                               </div>
		               <div class='trigger_default'>
                                   <a href='#'>Discuss</a>
                               </div>
		               <div class='toggle_container_default'>
                                  <ul class='reply_text'>
                                      <?php include('get_reply.php');?>
                                  </ul>
                               <div class='block'>
                                  <form name='disscuss_text' id='post_reply' id='post_reply'>
                                     <textarea rows='3' cols='87' id='discuss_text' name='discuss_text'></textarea>
                                     <input type='submit' value='Post' name='Help' id='post-button' />
                                  </form>
                               </div>
		           </div>
	               </div>	
	           </li>
                   <?php 
                   }
                   ?>
               </ul>

Can't see any unclosed braces. Check your include files for unclosed braces.

OMG!!! You are my saviour man! Now only i know the correct way to insert the HTML code into the PHP..Now my problem is finally solved..

Thank You very much :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.