Jump to content

Parse error: syntax error, unexpected end of file in ... on line 103


Recommended Posts

Hi guys i have this error,

Parse error: syntax error, unexpected end of file in C:\wamp64\www\nigthclub\videos.php on line 103

 

but i know is probably easy to solve but for some reason i dont see the error. please help me

<?php

session_start();

?>

<?php error_reporting (E_ALL ^ E_NOTICE); ?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

<link href="style.css" rel="stylesheet" type="text/css" />

<link href="tablefiestas.css" rel="stylesheet" type="text/css" />

<title>La Taverna de Juan</title>

</head>

<body>

<div id="container">

    <div id="header">

    <!--MENU BAR-->

  <?php include("includes/db.php"); ?>

    </div>

    <!--VIDEOS-->

<?php
$query = ("SELECT * from videos");
$result = mysqli_query($connection,$query);

$num_per_page =05;


?>

<table border="1" width="100%">
<tr>
  <td>Video Id</td>
  <td>Titulo</td>
  <td>Video</td>
</tr>
<tr>
  <?php
 
  while ($row=mysqli_fetch_assoc($result))
 
      {
      $videoid = $row['videoid'];
      $titulo = $row['titulo'];
      $url_video = $row['url_video'];
   ?>
   
       <td><?php echo $videoid ?></td>
       <td><?php echo $titulo ?></td>
       <td><?php echo $url_video ?></td>
   </tr>
   
   
   <?php}?>


</table>
 <?php
          $query =  "SELECT * from  videos";
          $pr_result = mysqli_query($connection,$query);
          $totalrecord =  mysqli_num_rows($pr_result);
          echo $totalrecord;

 ?>

    <br>

    <div id="footer">

 <!--FOOTER-->

    <?php include("includes/footer.inc.php"); ?>

    </div>    

</div>

</body>

</html>

 

Edited by Psycho
Added code tags
Link to post
Share on other sites

Try changing this:
 

$query = ("SELECT * from videos");

to this:

$query = 'SELECT * from videos';

 

Also, you should really avoid escaping in and out "<?php" and "?>" of PHP like this. Instead, keep your HTML in separate template files, and load them via require. This is also known as "views", but I prefer to call it "templates", since that makes more logical sense to me.

Link to post
Share on other sites

1 - Yes!  Stop going in and out of php mode.  Learn how to code better.

2 - How about those echos you buried in the td statements?  They look a bit different from your other lines doing similar things.  Add a semi.

Link to post
Share on other sites

See if this makes sense to you.

<?php
/* ******************************
	script name
	description of what this does
	end of comments
********************************* */
session_start();
error_reporting (E_ALL ^ E_NOTICE); 
include "includes/db.php";
$query = "SELECT videoid, titulo, url_video from videos";
$result = mysqli_query($connection, $query);
$num_per_page =05;
$table_data = "
	<table border='1' width='100%'>
	<tr>
	<th>Video Id</th>
	<th>Titulo</th>
	<th>Video</th>
	</tr>
	";
while (list($videoid, $titulo, $url_video) = mysqli_fetch_row($result))
{
	$table_data .= "
	<tr>
	<td>$videoid</td>
	<td>$titulo</td>
	<td>$url_video</td>
	</tr>";
}
$table_data .= "
	</table>
	<br>
	";
$query =  "SELECT * from  videos";
$pr_result = mysqli_query($connection, $query);
$table_data .= "Results found: " . mysqli_num_rows($pr_result);
//
//  Now output the html data including the generated data above.
//
echo $html=<<<heredocs
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link href="style.css" rel="stylesheet" type="text/css" />
<link href="tablefiestas.css" rel="stylesheet" type="text/css" />
<title>La Taverna de Juan</title>
</head>
<body>
<div id="container">
<div id="header">
<!--MENU BAR-->
</div>
<!--VIDEOS-->
$table_data
<br>
<div id="footer">
<!--FOOTER-->
heredocs;
//
echo $html;
//
include "includes/footer.inc.php";
echo "
	</div>    
	</div>
	</body>
	</html>
	";
exit();

I may have not inserted the table data in the correct place in your html block but I'm sure you can place it in the correct spot if not.

Link to post
Share on other sites
This thread is more than a year old.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.