Me and my mate we're trying to solve this for over 1.5 hours, we are still getting the same and tried almost everything we could. Could anyone help us do that? ,This is error what we're getting:
( ! ) Parse error: syntax error, unexpected '}' in C:\aboamirtbk\www\edit.php on line 141
Thanks to everyone who will help. :)
<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";
}
?>
答案 0 :(得分:0)
You have missed opening brace of elesif added at line no 84
<?php
} elseif(!empty($_POST['username']) && !empty($_POST['password']))
{ // you missed opening brace here
答案 1 :(得分:0)
You forgot to add opening curly brace for else if . Please check below modification:
. . .
<?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']));
. . .
答案 2 :(得分:0)
I think this is the caused of the problem
if ($result2 = $con->query("SELECT * FROM students WHERE students.student_number = '".$username."'"))
There are no curly brackets of that condition.