1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
|
<?php
mysql_connect("localhost","root") or die("erreur de connexion au serveur $host");
mysql_select_db("job");
//recherche des résultats dans la base de données
if(isset($_GET["recherche"])){
$sector = $_GET['sector'];
$country = $_GET['country'];
$jobtype = $_GET['jobtype'];
$level = $_GET['level'];
$job = $_GET['job'];
$sql = "SELECT COUNT(id) as nbArt FROM post where sector ='$sector' and country='$country' and jobtype='$jobtype' and level='$level' and job='$job'";
$result = mysql_query($sql) or die (mysql_error());
$data=mysql_fetch_assoc($result);
$nbArt=$data['nbArt'];
$perPage=4;
$nbPage = ceil($nbArt/$perPage);
if (isset($_GET['p']) && $_GET['p']>0 && $_GET['p']<=$nbPage ) {
$cPage=$_GET['p'];
}
else
{$cPage=1;}
$cPage=1;
$sql = "SELECT namejob, local, description , adddate , country , imagejob
FROM post
where sector ='$sector' and country='$country' and jobtype='$jobtype' and level='$level' and job='$job' LIMIT ".(($cPage-1)*$perPage).",$perPage ";
$result = mysql_query($sql) or die('Erreur SQL !'.$sql.'<br /><b>'.mysql_error().'</b>');
if (mysql_num_rows($result)){
while($row = mysql_fetch_assoc($result)){
echo' <div class="tab_grid">
<div class="jobs-item with-thumb">
<div class="thumb"><a href="jobs_single.html"><img src="'.$row['imagejob'].'" class="img-responsive" alt=""/></a></div>
<div class="jobs_right">
<div class="date">30 <span>Jul</span></div>
<div class="date_desc"><h6 class="title"><a href="jobs_single.html">'.$row['namejob'].'</a><span class="m_1"></h6>
<span class="meta"><strong>'.$row['local'].','.$row['country'].'</strong> | Posted'.$row['adddate'].'</span>
</div>
<div class="clearfix"> </div>
<ul class="top-btns">
<li><a href="#" class="fa fa-star-o"></a></li>
<li><a href="#" class="fa fa-link"></a></li>
</ul>
<p class="description">'.$row['description'].'<a href="jobs_single.html" class="read-more"><strong>Apply for this job</strong></a></p>
</div>
<div class="clearfix"> </div>
</div>
</div>';
}
for ($i=1;$i<=$nbPage;$i++){
if ($i==$cPage)
echo " $i / ";
else
{
echo " <a href=\"search.php?p=$i\">$i</a> /" ;
}
}
}
else {echo' <h3 style="text-align:center; margin:10px 0;">Pas de résultats pour cette recherche</h3>';}
}
?> |
Partager