I have this error:
Parse error: syntax error, unexpected $end in /…../student.php on line 57
note: the lines in “student.php” it’s only 56 lines, so the error appear in addition line !
<?php
session_start();
if(!isset($_SESSION['user_login']))
include('login.php');
else
{?>
<a href=student.php?add=1>تسجيل طالب</a><br>
<a href=student.php?edit=1>تعديل بيانات طالب</a><br>
<?php
if($_GET['add'] ==1)
{?>
<form action="student.php?add=2" method="POST">
<input type="text" name="name" size="25" maxlength="50"> إسم الطالب:
<br>
<input type="text" name="birthday" size="25" maxlength="50"> تاريخ الميلاد:
<br>
<input type="text" name="phone" size="25" maxlength="50"> رقم الهاتف:
<br>
<input type="text" name="mobile" size="25" maxlength="50"> رقم الهاتف النقال:
<br>
<input type="text" name="email" size="25" maxlength="50"> البريد الإلكتروني:
<br>
<input type="text" name="comment" size="25" maxlength="100"> ملاحظات:
<br>
<input type="submit" value="اضف">
<input type="reset" value="مسح">
</form>
<?php
}
else if($_GET['add'] ==2)
{
$name = $_POST['name'];
$birthday = $_POST['birthday'];
$phone = $_POST['phone'];
$mobile = $_POST['mobile'];
$email = $_POST['email'];
$comment = $_POST['comment'];
$add = "INSERT INTO student(S_ID, S_Name, S_DOB, S_HomeTele, S_Mobile, S_Email, S_Comment) VALUES(NULL, '$name','$birthday','$phone','$mobile','$email','$comment')";
$addq = MYSQL_QUERY($add);
if($addq)
{
echo"تم اضافة الطالب بنجاح<br>";
echo"<a href=student.php?add=1>اضغط هنا لإضافة طالب آخر</a><br>";
echo"<a href=student.php>اضغط هنا للعودة لصفحة الطلاب الأولى</a><br>";
echo"<a href=admin.php>اضغط هنا للعودة للصفحة الأولى للوحة التحكم</a><br>";
}
else
{
echo"<br>هناك خطأ، لم يتم اضافة الطالب";
echo"<a href=student.php?add=1>اضغط هنا لإضافة طالب آخر</a><br>";
echo"<a href=student.php>اضغط هنا للعودة لصفحة الطلاب الأولى</a><br>";
echo"<a href=admin.php>اضغط هنا للعودة للصفحة الأولى للوحة التحكم</a><br>";
}
}
?>
The error means that there is a curly brace
{without a matching closing curly brace. It reached the end of the file and didn’t find one, which is why it reported it as one past the last line of the file.The closing
}of the firstelseblock is missing. Adding one to the last line of the file (before the closing?>) should do the trick.