williamh69 Posted November 18, 2019 Share Posted November 18, 2019 (edited) 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 November 18, 2019 by Psycho Added code tags Quote Link to comment Share on other sites More sharing options...
JacobSeated Posted November 18, 2019 Share Posted November 18, 2019 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. Quote Link to comment Share on other sites More sharing options...
requinix Posted November 18, 2019 Share Posted November 18, 2019 29 minutes ago, williamh69 said: <?php}?> PHP requires that opening tags have at least one character of whitespace after them. Or be at the end of the file. Quote Link to comment Share on other sites More sharing options...
ginerjm Posted November 18, 2019 Share Posted November 18, 2019 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. Quote Link to comment Share on other sites More sharing options...
ginerjm Posted November 18, 2019 Share Posted November 18, 2019 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.