-1
我試圖獲取該id並將其存儲在一個變量中,但它表明 變量未定義,查詢是不是因爲變量而執行,我不明白爲什麼。未定義的變量:第17行中的C: xampp htdocs training.php中的sql
include 'connect.php';
if(isset($_GET['OrgName']))
{
$file=$_GET['OrgName'];
$sql="SELECT oraganzation.OrgName,oraganzation.City,oraganzation.OrgEmail,oraganzation.OrgPhoneNO, oraganzation.Workfield, oraganzation.Trainingrecruitment, oraganzation.WebsiteLink,Student_comments.comment
FROM oraganzation , Student_comments
WHERE oraganzation.OrgName=$file AND oraganzation.OrgID=Student_comments.OrgID ";
}
$result= mysqli_query($con,$sql) or die ("could not found; ".mysqli_error ($con));
while ($row=mysqli_fetch_array($result))
{
echo "<br><strong> Name : </strong>". $row['OrgName'].
"<br><strong>
<br><strong> City : </strong>". $row['City'].
"<br><strong>
Email: </strong>" . $row['OrgEmail'].
"<br><strong>
PhoneNO: </strong>". $row['OrgPhoneNO'].
"<br> <strong>
Work field: </strong> " . $row['Workfield'].
"<br><strong>
Training recruitment:</strong> " . $row['Trainingrecruitment'].
"<br> <strong>
Website Link: </strong> " . $row['WebsiteLink'].
"<br> <strong>
Comments: </strong> " .$row['comment']. "<br>" ;
}
這是從以前的頁面我的代碼,我把A HREF爲獲取名稱
$sql="SELECT OrgName, City, OrgEmail, OrgPhoneNO, Workfield, Trainingrecruitment, WebsiteLink,OrgID
FROM oraganzation";
$result= mysqli_query($con,$sql) or die ("could not found; ".mysqli_error($con));
while ($row=mysqli_fetch_array($result))
{
?>
<div class="content ">
<a href="training.php?name=<?php echo $row['OrgName'] ?> "><?php echo $row['OrgName'] ;?> </a>
<?php
echo "<br><strong> City : </strong>". $row['City'].
"<br><strong>
Email: </strong>" . $row['OrgEmail'].
"<br><strong>
PhoneNO: </strong>". $row['OrgPhoneNO'].
"<br> <strong>
Work field: </strong> " . $row['Workfield'].
"<br><strong>
Training recruitment:</strong> " . $row['Trainingrecruitment'].
"<br> <strong>
Website Link: </strong> " . $row['WebsiteLink'].
"</div> ";} ?>