Expand|Select|Wrap|Line Numbers
- <form name="form" action="search.php" method="get">
- <input type="text" name="q" />
- <input type="submit" name="Submit" value="Search" />
- </form>
Expand|Select|Wrap|Line Numbers
- <?php
- include('lock.php');
- include("config.php");
- $var = @$_GET['q'] ;
- $trimmed = trim($var);
- // rows to return
- if ($trimmed == "")
- {
- echo "<p>Please enter a search...</p>";
- exit;
- }
- /*if (!isset($var))
- {
- echo "<p>We dont seem to have a search parameter!</p>";
- exit;
- }*/
- $query = "select * from candidate where cname like \"%$trimmed%\" || skills like \"%$trimmed%\" || exp like \"%$trimmed%\" || indus like \"%$trimmed%\" || qual like \"%$trimmed%\" ORDER BY cid ";
- $result=mysql_query($query);
- $num=mysql_numrows($result);
- if ($num == 0)
- {
- echo "<h4>Results</h4>";
- echo "<p>Sorry, your search: "" . $trimmed . "" returned zero results</p>";
- }
- echo "<p>You searched for: "" . $var . ""</p>";
- echo "Results";
- print "<table width='100%' border='1'>";
- print "<tr><th align='center'>Name</th><th align='center'>Email</th><th align='center'>Qualification</th><th align='center'>Skills</th><th align='center'>Resume</th></tr>";
- $i=0;
- while ($i < $num) {
- $cname=mysql_result($result,$i,"cname");
- $email=mysql_result($result,$i,"email");
- $skills=stripslashes(mysql_result($result,$i,"skills"));
- $qual=mysql_result($result,$i,"qual");
- $id=mysql_result($result,$i,"cid");
- $filename=mysql_result($result,$i,"res_title");
- print "<tr>
- <td>$cname</td>
- <td>$email</td>
- <td>$qual</td>
- <td>$skills</td>
- <td><img src='download.gif'> <a href='download.php?id=$filename'>$filename</a></td>
- <td><a href='mailto:'>Forward</a></td>
- <td><a href='updatestatus.php'>Update</a></td>
- </tr>";
- $i++;
- }
- print "</table>";
- ?>
if i enter a search like " be java", then,
i have to search the db for 'be' key word and 'java' keyword seperately. then the result should be the candidates who having qualification 'be' and skills 'java' only to be displayed... how? help...