您好我正在尝试在网址中设置什么,并从中形成一个sql select语句
然而,这种情况不断出现: 警告:mysql_fetch_array()要求参数1为资源,在第76行的C:\ xampp \ htdocs \ JobBoard \ viewjobs.php中给出布尔值
我一直试图解决这个问题,并提出了太多想法来解决它。我相信这对某人来说很容易解决。
由于
<?php
include 'db_connect.php';
$addedquery = '';
if(isset($_GET["hot"]))
{
//$hotjob = $_GET["hot"];
$addedquery = "AND hot=yes $addedquery"; <<<<<<<<---------
}
if(isset($_GET["nursing"]))
{
//$nursingjob = $_GET["nursing"];
$addedquery = "AND nursing=yes $addedquery"; <<<<<<<<---------
}
?>
<html>
<head>
<title>
</title>
</head>
</head>
<body>
<?php include 'menu.php'; ?>
<h3></h3>
<div id="contentcontainer">
<div id="viewjobsearch">
<form action="jobprocess.php" method="post">
<h3>Job Search</h3>
<h4>Keyword</h4>
<input type="text" name="cf_name">
<h4>Location</h4>
<input type="text" name="cf_name">
<h4>Distance</h4>
<select name="miles">
<option value="10m">10 miles</option>
<option value="25m">25 miles</option>
<option value="50m">50 miles</option>
<option value="National">National</option>
</select>
<h4>Job Type</h4>
<select name="jobtype">
<option value="perm">Permanent</option>
<option value="part">Part Time</option>
<option value="grad">Graduate</option>
<option value="contract">Contract</option>
<option value="temp">Temporary</option>
</select>
</br></br>
<input type="submit" value="Send" />
</form>
</div>
<div id="viewjob">
<h3>$keyword</h3>
</br>
<div id="viewjobsort">
Ordered by:
<select name="order">
<option value="alpha">Date Posted</option>
<option value="part">Salary</option>
<option value="part">Name</option>
</select>
</div>
</br>
<?php
$counta = mysql_query('SELECT COUNT(`jobID`) AS num FROM `jobs`') or die(mysql_error());
$countb= mysql_fetch_assoc($counta);
$countc = $countb['num'];
//$sql = mysql_query("select * from jobs WHERE jobID='$jobID' ");
$sql = mysql_query("select * from jobs WHERE jobID>'' $addedquery"); <<<<<<<<---------
//$r_query = mysql_query($sql);
while ($row = mysql_fetch_array($sql)){
$employerid = $row['employerID'];
$sql2 = mysql_query("select * from employers WHERE employerID='$employerid' ");
$row2 = mysql_fetch_array($sql2);
$jobname=$row['name'];
$loc=$row['cLine'];
$sal=$row['salary'];
$hours=$row['hours'];
$dateposted=$row['datePosted'];
$employer=$row2['name'];
$description=$row['description'];
$jobid=$row['jobID'];
echo "<div id='list'>
$jobname</br>
Location: $loc</br>
Salary: $sal</br>
Hours: $hours</br>
Date Posted: $dateposted</br>
Employer: $employer</br>
$description</br>
<a href='job.php?id=$jobid'>View Job</a>
</div>";
}
?>
</div>
</div>
<div id="footercontainer">
<div id="foot1"> </br>   Important Links </br>   <a href="contact.php">Contact Us</a></br></br></br></div>
<div id="foot2"> </br> Foot2</div>
</div>
<div id="footercc">Job Board System by Naiven Dhali</div>
</body>
</html>