-1
私はIDを取得して変数に格納しようとしていますが、 変数が定義されておらず、クエリが変数のために実行されない、私はなぜ理解していない。未定義の変数:sql in C: xampp htdocs training.php on line 17
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>" ;
}
そして、これは私が
$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> ";} ?>