i am trying to retrieve data from table by using check box values. but while running that program am getting tese following errors please let me know where i did the mistake!!!!!! here is my code
<html>
<?php
if(isset($_POST["refine1"]))
{
$hyd=$_POST["hyd"];
$bnglr=$_POST["bnglr"];
$chni=$_POST["chni"];
$pne=$_POST["pne"];
$mbi=$_POST["mbi"];
$dli=$_POST["dli"];
$j=1;
$sql="select * from jobs where location=$hyd OR location=$bnglr OR location=$chni OR location=$pne OR location=$mbi OR location=$dli";
mysql_select_db("goget");
$rtvl=mysql_query($sql);
echo "<form method='post'><table width='600px'>";
while ($row=mysql_fetch_array($rtvl))
{
echo "<tr><td><input type='checkbox' name='r".$j."' value='$row[1]'>
<a href='just.php?id=".$row[2]."' style='color:blue' name='".$j."' target='_blank'>".$row['jobtitle']."</a>".$row['date']."</td></tr><tr><td>".$row['companyname']."</td></tr>
<tr><td>".$row['jobdiscription']."</td></tr><tr><td></td></tr><tr><td></td></tr>";
$j++;
}
Please use this forum's [php]...[/php] bbcode tags around your code samples.
If any/all of those values are strings, their variables will need to be single-quoted within your SQL.
Note that your code is open to SQL injection attacks/errors due to those inputs not being escaped. Better yet: use the more up-to-date MySQLi or PDO extension with prepared statements and bound parameters in order to automatically handle input escaping where needed.
"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation
Bookmarks