Jump to content

[SOLVED] simple search engine and links


reddavis999

Recommended Posts

Hi, ive created a simple search engine for a college project ive been working on. Heres the code...

 

<?php session_start();

if 	($_SESSION['logged'] != true)
{
	header('location: register.php');
	exit();
}
?>


<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>jobs</title>
<meta name="generator" content="TextMate http://macromates.com/">
<meta name="author" content="Red Davis">
<!-- Date: 2007-05-08 -->
<link rel="stylesheet" media="screen" type="text/css"
href="style.css"/>
</head>
<body>


<div id="header"> 
  <div id="header1"> </div>
  <div id="header2"> </div>
  <div id="logo"> </div>
  <div id="header3"> </div>
  <div id="tabs"> </div>
</div>


<div id="leftbar"> </div>

<div id="links1"		
	<div id="home"><a href="index_logged_in.php">Home</a></div>
	<div id="investor"><a href="investor.htm">Investor</a></div>
	<div id="jobs"><a href="jobs.php">Jobs</a></div>
	<div id="register"><a href="register.php">Register</a></div>
</div>
	<div id="welcome">
		<?php echo "Welcome, ".$_SESSION['username'] ; ?>
</div>


	<div id="logout">
		<a href="logout.php">Logout</a>
	</div>

<?php
	include ("name.inc");

	mysql_connect ("$host","$username","$password")
		or die ("couldnt connect");
	mysql_select_db ("$database")
		or die ("cannot select database");


	//set variables
	$request = $_GET['dropdown'];

	$search = mysql_query("SELECT * FROM $table2 WHERE jobtype='$request'")
		or die (mysql_error());

	while ($row = mysql_fetch_array($search)) {
		echo $row['jobtitle']."<br>";
	}

?>

<div id="rightbar"> </div>







</body>
</html>

 

The search works fine but i want it to return links. So that if the user searched programmer jobs, the search would return the job title and a link to the full article (which would contain jobdescription). A bit like the youtube search.

 

Thanks for your help, Red

Link to comment
Share on other sites

thanks :)

please correct me if im wrong...

 

When a user submits a job, it goes to a script that creates a new page. This page is then stored in a table along with the job name, description etc.?

 

Then when a user seaches 'programmer' jobs it will display links for the jobs, so when the user clicks on them it goes the page that was created earlier?

 

What is this type of thing called, when it has .php?id=1 ? becuase i would like to look for some tutorials on it to learn more.

 

thanks for your help

Link to comment
Share on other sites

My site has something like this:

http://snippets.tzfiles.com

 

Each snippet has its own ID number, and when a user clicks on a link, the all use the same file (snippet.php) but each has its own unique values in the URL ?id=3 or ?id=34 etc. and like said above the page layout stays the same, only the content is generated from a data source such as a database.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.