Click here to Skip to main content
14,699,126 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
$conn = mysqli_connect('localhost','root','','khazar');
	die("Connection failed!!!").mysqli_error();
	echo "Connected succesfully";

$sql = "SELECT * FROM students";
$result = mysqli_query($conn,$sql);
	die("table connection problem!");
// listing all datas from table
echo "<h2>List of al records: ".mysqli_num_rows($result)."</h2>";
echo "<table>";
	while ($row = mysqli_fetch_assoc($result)) {
		echo $row['id']." | ".$row['name']." | ".$row['username']." | ".$row['password']."<br>";

		<form method="post" action="$_SERVER['PHP_SELF']">
		<a href="f.php? id=<?php echo $row['id']?>">DELETE</a>
		<a href="f.php? id=<?php echo $row['id']?>">EDIT</a>
		<a href="f.php? id=<?php echo $row['id']?>">UPDATE</a>

<!--	}   -->
	$id = $_GET['id'];
	$sql2 = "DELETE FROM students WHERE id=".$id;

What I have tried:

error is:

Parse error: syntax error, unexpected end of file in C:\xampp\htdocs\f.php on line 39

i changed many things and tried,but this error always exist.
please,say,what does this error mean? and what actually error is ?
Updated 24-Feb-20 9:23am

1 solution

The "unexpected end of file" error usually means you have a php block unterminated. The parser reads off the end of the file searching for block termination, usually }.
In your case, the } right before your second <?php is the culprit. It's not in the php context, so the while loop is unterminated. Move the } after the <?php and you'll get a bit further.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900