私が取り組んでいるウェブページがあります。リンクは次のとおりです。
http://nexusdesign.org.uk/irejobs/training-courses.html
そのコードは以下のとおりです。バックエンドで、示されているようにトレーニング コースのエントリを作成しましたが、これらは表示されません。これらは、データベース db_trainings からここと下の別の機能ボックスの両方にプルする必要があります。
ここで何がうまくいかないのか誰にもアドバイスできますか??
<?php
ob_start();
require_once("conn.php");
$pagename = "training";
$submenu = "trainings";
require_once("header.php");
require_once("pager.php");
$__table = "db_trainings";
$__page = $_SERVER['PHP_SELF'];
$__id = "TrainingID";
$__uploadfolder = "myimages/";
$NUM_COL = 2;
$NUM_ROW = 5;
$perPage = $NUM_COL * $NUM_ROW;
$page=isset($_GET['page']) ? intval($_GET['page']):1;
$MemberID = $_GET['MemberID'];
if($MemberID != "")
$andmember = " and MemberID = '".$MemberID."'";
$category = "";
$i = 0;
$r1 = mysql_query("select * from db_training_categories") or die(mysql_error());
while($a1 = mysql_fetch_array($r1))
{
if($_GET['category-'.$a1['CatID']] == "1")
{
if($i != 0)
$andcategory .= " or ";
$andcategory .= " t.category = ".$a1['CatID'];
$i++;
}
}
if($andcategory != "")
$andcategory = " and (".$andcategory.")";
$city = $_GET['city'];
if($city == "enter city")
$city = $_GET['citys'];
if($city != "" and $city != "enter city")
$andcity = " and t.city = '".$city."'";
$country = $_GET['country'];
if($country != "")
$andcountry = " and t.country = '".$country."'";
$stxt = $_GET['srchTxt'];
if($stxt == "enter keywords")
$stxt = $_GET['srchTxts'];
if($stxt != "" and $stxt != "enter keywords")
{
$srchTxt = " and (t.title like '".$stxt."%' or t.title like '%".$stxt."' or t.title like '%".$stxt."%'";
$srchTxt .= " or t.provider like '".$stxt."%' or t.provider like '%".$stxt."' or t.provider like '%".$stxt."%'";
$srchTxt .= " or t.city like '".$stxt."%' or t.city like '%".$stxt."' or t.city like '%".$stxt."%'";
$srchTxt .= " or t.terms like '".$terms."%' or t.city like '%".$stxt."' or t.terms like '%".$stxt."%'";
$srchTxt .= " or t.price like '".$stxt."%' or t.price like '%".$stxt."' or t.price like '%".$stxt."%'";
$srchTxt .= " or t.duration like '".$stxt."%' or t.duration like '%".$stxt."' or t.duration like '%".$stxt."%'";
$srchTxt .= " or t.qualification like '".$stxt."%' or t.qualification like '%".$stxt."' or t.qualification like '%".$stxt."%'";
$srchTxt .= " or t.awardingbody like '".$stxt."%' or t.awardingbody like '%".$stxt."' or t.awardingbody like '%".$stxt."%'";
$srchTxt .= " or t.description like '".$stxt."%' or t.description like '%".$stxt."' or t.description like '%".$stxt."%'";
$srchTxt .= " )";
}
if ($_GET['sortby'] == "newest") {
$sortby = "newest";
$sortbyt = " order by t.TrainingID desc";
}
elseif ($_GET['sortby'] == "oldest") {
$sortby = "oldest";
$sortbyt = " order by t.TrainingID asc";
}
else
$sortbyt = " order by t.TrainingID desc";
$textQuery = "select *,t.city,t.country from db_trainings t, db_members m where t.MemberID <> '' and t.MemberID = m.MemberID and m.advertisementexpiry > 0 and t.active = 'yes' ". $andmember . $andcountry . $andcity . $andcategory . $andmember . $srchTxt . $sortbyt;
//for paging
$ress = mysql_query($textQuery);
$total=mysql_num_rows($ress);
$maxpage = floor($total/$perPage);
if($total%$perPage !=0)
$maxpage += 1;
if($page == 0)
{
$start = 0;
$page = 1;
}
else
$start = ($perPage * $page) - $perPage;
$stop = $start + $perPage;
$qry = $textQuery." limit $start, $perPage";
//echo $qry;
$r = mysql_query($qry);
?>
<script language="javascript">
function showRecords(id)
{
document.frmItems.page.value = id;
document.frmItems.method = "get";
document.frmItems.action = "training-courses.html";
document.frmItems.submit();
}
function validateForm()
{
document.frm.action = "training-courses.html";
document.frm.submit();
}
</script>
<div id="container">
<div class="wrap">
<div class="corner-box-bot">
<?
if($_SESSION['MemberType'] == 'Employer')
include("employer-menu.html");
elseif($_SESSION['MemberType'] == 'Seeking')
include("seeker-menu.html");
elseif($_SESSION['MemberType'] == 'Training')
include("training-menu.html");
?>
<div class="content">
<div style="float:left;width:280px;"><h1>Training & Skills</h1>
<strong class="blue" style="line-height: 31px; font-size: 14px;">
Upgrade
your skills and qualifications?<br />
Find out what's available near you:
<br /><br />
</strong></div>
<div style="float:right;width:550px;">
<p><strong>Training providers: </strong>use www.PaediatricNursingJobs.com to effectively promote your courses to students in the UK & internationally .</p>
<strong>Reach out and speak to a global market of clients and students</strong>
<?
if($_SESSION['MemberID'] == "")
echo "<a href='login-training.html' class='blue-btn-04' style='font-size:13px;margin-top:20px;'>ADVERTISE YOUR COURSES HERE</a>";
else
echo "<a href='training-courses-add.html' class='blue-btn-04' style='font-size:13px;margin-top:20px;'>ADVERTISE YOUR COURSES HERE</a>";
?>
</div>
<div class="clear"></div>
<form name="frmItems" id="frmItems">
<input type="hidden" name="page" value="">
<input type="hidden" name="MemberID" value="<?=$MemberID?>">
<input type="hidden" name="srchTxts" value="<?=$stxt?>">
<div class="side_bar">
<h1 style="line-height:1;">Advanced Search</h1>
<h2 class="blue">Course Location</h2>
<div class="custom-select-2" id="select-box-01">
<select name="country">
<option value="">select country</option>
<?
$r2 = mysql_query("select * from db_countries order by Name = 'United Kingdom' desc, Name") or die(mysql_error());
while($a2 = mysql_fetch_array($r2))
{
if($a2['CountryID'] == $country)
echo "<option value='".$a2['CountryID']."' selected>".$a2['Name']."</option>";
else
echo "<option value='".$a2['CountryID']."'>".$a2['Name']."</option>";
}
?>
</select>
</div>
<div class="custom-select-2" id="select-box-02">
<input type='text' name='city' class='txt-field-2' value='enter city' />
</div>
<div class="clear"></div>
<div style="border-top: 1px solid #d4d4d4; padding-top: 20px; margin-top: 10px;">
<h2 class="blue">Course Subject</h2>
<div class="custom-select-2" id="select-box-04">
<?
$r1 = mysql_query("select * from db_training_categories order by CatName") or die(mysql_error());
while($a1 = mysql_fetch_array($r1))
{
if($_GET['category-'.$a1['CatID']] == "1")
echo "<input type='checkbox' name='category-".$a1['CatID']."' value='1' checked /> ".$a1['CatName']."<br />";
else
echo "<input type='checkbox' name='category-".$a1['CatID']."' value='1' /> ".$a1['CatName']."<br />";
}
?>
</div>
</div>
<div style="border-top: 1px solid #d4d4d4; padding-top: 20px; margin-top: 20px;">
<a href="javascript:void(0);" class="blue-btn-06" onClick="showRecords(1);">Search for course</a>
</div>
</div>
<div class="col_710 r-content">
<?
if(mysql_num_rows($r) > 0)
{
$query = $_SERVER['QUERY_STRING'];
$arr = explode('&', $query);
if(strchr($arr[count($arr)-1],'page')!='')
array_pop($arr);
$purl = 'training-courses.html?'.implode('&', $arr);
?>
<div class="search-box">
<div>
<label>Training Title (e.g. Nurse)</label>
<input type="text" class="txt-field" name="srchTxt" />
</div>
<div>
<label>Training Location (e.g. Bristol)</label>
<input type="text" class="txt-field" name="citys" value="<?=$city?>" />
</div>
<a href="javascript:void(0);" class="blue-btn-02" onClick="showRecords(1);">Search</a>
<div class="clear"></div>
</div>
<div class="clear"></div>
<div class="sort-bar">
<span style="float: left; display: block; padding-top: 4px; width: 420px;"><strong class="blue"><?=$total?> courses found</strong></span>
<span style="float: left; display: block; padding-top: 4px;">Sort by</span>
<div class="custom-select-2" id="select-box-05">
<select name="sortby" id="sortby" class="input" onChange="showRecords(1);">
<option value="newest" <? if($_GET['sortby']=='newest') echo "selected"; ?>>Newest</option>
<option value="oldest" <? if($_GET['sortby']=='oldest') echo "selected"; ?>>Oldest</option>
</select>
</div>
<div class="clear"></div>
</div>
<div style="padding: 25px 0 0 25px;">
<?
$i=0;
while($a = mysql_fetch_array($r))
{
$r1 = mysql_query("select * from db_members where MemberID = '".$a['MemberID']."'") or die(mysql_error());
$a1 = mysql_fetch_array($r1);
$r2 = mysql_query("select * from db_categories where CatID = '".$a['category']."'") or die(mysql_error());
$a2 = mysql_fetch_array($r2);
$r3 = mysql_query("select * from db_countries where CountryID = '".$a['country']."'") or die(mysql_error());
$a3 = mysql_fetch_array($r3);
$r4 = mysql_query("select * from db_training_categories where CatID = '".$a['category']."'") or die(mysql_error());
$a4 = mysql_fetch_array($r4);
echo "
<div class='block-result'>
<img alt='' src='".$__uploadfolder.$a['logo']."' width='134' />
<div class='desc'>
<a href='training-courses-view.html?TrainingID=".$a['TrainingID']."'> ".cleaninput($a['title'],"ss|he|tr")."</a>
<span class='blue'>Location:</span> ".cleaninput($a['city'].", ".$a3['Name'],"ss|he|tr")."<br/>
<span class='blue'>Sector:</span> ".cleaninput($a4['CatName'],"ss|he|tr")."<br/>
<span class='blue'>Price:</span> ".$currency.cleaninput($a['price'],"ss|he|tr")."<br/>
<span class='blue'>Duration:</span> ".cleaninput($a['duration'],"ss|he|tr")." hours<br/>
</div>
</div>
";
$i++;
}
?>
</div>
<?
if($maxpage > 1)
echo showpage($page,$purl,$total,$maxpage,$perPage);
}
else
echo "
<div class='sort-bar' style='margin-top: 0px'>
<span style='float: left; display: block; padding-top: 4px; width: 420px;'><strong class='blue'>No results found...</strong></span>
<div class='clear'></div>
</div>
";
?>
</div>
</form>
<div class="clear"></div>
</div>
</div>
<? include("bottom-featuredcourses.php"); ?>
<div class="clear"></div>
</div>
</div>
<?php
require_once("footer.php");
ob_flush();
?>