我和我的夥伴我們正試圖解決這個問題超過1.5小時,我們仍然相同並嘗試幾乎所有可能的東西。 任何人都可以幫助我們做到這一點? ,這是我們得到的錯誤:解析錯誤:語法錯誤,在線發生意外的'}'
(!) Parse error: syntax error, unexpected '}' in C:\aboamirtbk\www\edit.php on line 141
感謝每個人的幫助。 :)
<html>
<body>
<center>
<?php include("table_php().php");
if(!empty($_SESSION['LoggedIn0']) && !empty($_SESSION['student_number']))
{
?>
<br><br>
<?php
include "base.php";
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$username = $_SESSION['student_number'];
if ($result = $con->query("SELECT * FROM students WHERE students.student_number = '".$username."'"))
{
if ($result->num_rows > 0)
{
echo "<table border='1' cellpadding='10'>";
echo " <tr> <th><font color=red size=5>שם</font></th> <th><font color=red size=5>שם משפחה</font></th> <th><font color=red size=5>סיסמה</font></th> <th><font color=red size=5>דואר אלקטרוני</font></th><th><font color=red size=5>Edit</font></th> </tr>";
while ($row = $result->fetch_object())
{
echo "<tr>";
//echo "<td>" . $row->ID. "</td>";<th>ID</th>
echo "<td>" . $row->student_name . "</td>";
echo "<td>" . $row->student_last . "</td>";
echo "<td> Can't Show</td>";
echo "<td>" . $row->student_email . "</td>";
echo "<td><a href='edit1.php?id=" . $row->student_name . "'>Edit</a></td>";
// echo "<td><a href='delswim.php?id=" . $row->student_name . "'>Delete</a></td>";
echo "</tr>";
}
echo "</table><br>";
}
else
{
echo "No results to display!";
}
}
else
{
echo "Error: " . $con->error;
}
if ($result2 = $con->query("SELECT * FROM students WHERE students.student_number = '".$username."'"))
echo "<table border='1' cellpadding='10'>";
echo " <tr> <th><font color=red size=5>מספר סטודנט</font></th> <th><font color=red size=5>מוסד לימוד</font></th> <th><font color=red size=5>כתובת סטודנט</font></th> </tr>";
while ($row2 = $result2->fetch_object())
{
echo "<tr>";
//echo "<td>" . $row->ID. "</td>";<th>ID</th>
echo "<td>" . $row2->student_number . "</td>";
echo "<td>" . $row2->student_collage . "</td>";
// echo "<td> Can't Show</td>";
echo "<td>" . $row2->student_address . "</td>";
// echo "<td><a href='edit1.php?id=" . $row->student_name . "'>Edit</a></td>";
// echo "<td><a href='delswim.php?id=" . $row->student_name . "'>Delete</a></td>";
echo "</tr>";
}
echo "</table>";
$con->close();
?>
</center>
</body>
</html>
<?php
} elseif(!empty($_POST['username']) && !empty($_POST['password']))
$username = mysqli_real_escape_string($con,$_POST['username']);
$password = md5(mysqli_real_escape_string($con,$_POST['password']));
$id_student = mysqli_real_escape_string($con,$_POST['id_student']);
$checklogin = mysqli_query($con,"SELECT * FROM `students` WHERE student_number = '".$username."' AND password = '".$password."' AND id_student= '".$id_student."'");
$check_var = mysqli_query($con,"SELECT * FROM groups WHERE student_number = '".$username."'");
$_SESSION['LoggedIn0'] = 1;
$checklogin = mysqli_query($con,"SELECT * FROM `students` WHERE student_number = '".$username."' AND password = '".$password."' AND id_student= '".$id_student."'");
$check_var = mysqli_query($con,"SELECT * FROM groups WHERE student_number = '".$username."'");
if(mysqli_num_rows($checklogin) == 1)
{
$row = mysqli_fetch_array($checklogin);
$row1 = mysqli_fetch_array($check_var);
$email = $row['student_name'];
$id = $row['id_student'];
$studentlast = $row['student_last'];
$email1 = $row['student_email'];
$birth = $row['student_datebirth'];
$last = $row['last'];
$student_address = $row['student_address'];
$student_collage = $row['student_collage'];
$_SESSION['id_student'] =$id;
$_SESSION['student_number'] = $username;
$_SESSION['last'] = $last;
$_SESSION['student_name'] = $email;
$_SESSION['student_last'] = $studentlast;
$_SESSION['student_email'] = $email1;
$_SESSION['student_datebirth'] = $birth;
$_SESSION['student_address'] = $student_address;
$_SESSION['student_collage'] = $student_collage;
$_SESSION['LoggedIn0'] = 1;
echo "<h1>הצלחתם להתחבר לפרופיל שלכם </h1>";
echo "<p>אנא המתן , להכין את נתוניך בפרופיל..</p>";
echo "<meta http-equiv='refresh' content='2;index.php' />";
}
else
{
echo "<h1>הכנסת נתונים לא נכונים</h1>";
echo "<p><strong>תבדוק הסיבות הבאות :</strong></p>";
echo "<ol start='1' type='1'>";
echo "<li>1. מספר זהות/מספר סטודנט/סיסמה שגויים</li>";
echo "<li>          2. יש תקלה בשרת של אתר , ותבדוק בזמן אחר בבקשה.</li>";
echo "<li>                                          3. תבדוק מ CAPS LOCK במקלדת שלך , אם כתבת נכון בשטח של סיסמה או לא .</li>";
echo "<li>                4. החשבון שלך נעול לפי הגדרה הנוהל , לך למזכירות שלכם.</li>";
echo "<li>5. הפרמטר של רווטר 10.0.0.2 שגוי           </li>";
echo "<li>6. תנסה עוד פעם דרך <a href=\"index.php\">כאן</a>.                       </li>";
echo "</ol>";
/* echo "<br><h3 align='center'> קוד שגייה : תקלה מאגר נתונים 501 </h3>";
*/
}
}
else
{
include "die.php";
}
?>
和141行是哪一行? – arkascha
這可能是因爲您在發佈的代碼部分中間的'elseif'後簡單地忘記了一個大括號。 – arkascha