Jump to content

Archived

This topic is now archived and is closed to further replies.

anthonydamasco

If PHP Search engine couldn't find anything....

Recommended Posts

If PHP Search engine couldn't find anything, I want it to say something like "revise your search"

this is the code i got

[code=php:0]
$search=$_POST["search"];
$result = mysql_query("SELECT * FROM joborder WHERE companyname LIKE '%$search%'");
while($r=mysql_fetch_array($result))
{
 
  $companyname=$r["companyname"];
  $posdes=$r["positiondescription"];
  $firstname=$r["firstname"];
  $date=$r["date"];
  $email=$r["email"];
  $id=$r["orderid"];
  $local=$r["nearestlocation"];
 
  echo " $companyname";
}
?>
[/code]

I dont even know how to start to do this

Share this post


Link to post
Share on other sites
Well this is what I got so far, and It doesnt work, what am I doing wrong?

[code=php:0]
$search = "$month, $day, $year"];
$result = mysql_query("SELECT * FROM joborder WHERE date LIKE '%$search%'");
while($r=mysql_fetch_array($result))
{
 
  $companyname=$r["companyname"];
  $posdes=$r["positiondescription"];
  $firstname=$r["firstname"];
  $date=$r["date"];
  $email=$r["email"];
  $id=$r["orderid"];
  $local=$r["nearestlocation"];

if (!$result){
  echo "please revise your search"
  }else{ 
  echo "<table width=\"600\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td><div align=\"center\"><a href=\"rrform.php?id=$id\">Click here to view this form</a></div></td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td width=\"44\">&nbsp;</td>
    <td width=\"369\">$companyname</td>
    <td width=\"82\"><img src=\"images/order.jpg\" width=\"67\" height=\"23\"></td>
    <td width=\"105\">$id</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>$firstname</td>
    <td><strong>Date</strong></td>
    <td><b>$date</b></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td><a href=\"$email\">$email</a></td>
    <td>&nbsp;</td>
    <td>$local</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td colspan=\"3\"><table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">
      <tr>
        <td>$posdes</td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td width=\"72%\">&nbsp;</td>
        <td width=\"28%\">&nbsp;</td>
      </tr>
    </table></td>
  </tr>
</table>";
}
?>
[/code]

Share this post


Link to post
Share on other sites
[code=php:0]
$search=$_POST["search"];
$result = mysql_query("SELECT * FROM joborder WHERE companyname LIKE '%$search%'");
$num = mysql_num_rows($result);
if ($num == "0"){
echo "You needs to be revisin' yo search, fool.";
}
else {
while($r=mysql_fetch_array($result))
{
  $companyname=$r["companyname"];
  $posdes=$r["positiondescription"];
  $firstname=$r["firstname"];
  $date=$r["date"];
  $email=$r["email"];
  $id=$r["orderid"];
  $local=$r["nearestlocation"];
 
  echo " $companyname";
}
}[/code]
[hr]
I imagine that may work.

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.