2 Replies - 815 Views - Last Post: 29 August 2009 - 07:49 PM Rate Topic: -----

#1 Dannyboy997   User is offline

  • D.I.C Regular
  • member icon

Reputation: 64
  • View blog
  • Posts: 258
  • Joined: 17-April 09

Search engine bidding

Post icon  Posted 29 August 2009 - 04:53 PM

I'm curently working on a big website or online business and i'm creating a search engine in php on the site for products, etc.. and i wanted to create a bidding system so business could bid for the top spot or top result i just thought of an idea that could work. here it is


in the script when i want to select a table so
$get = "SELECT * FROM search WHERE id='$id' ORDER BY rank INCREASING";


the part ORDER BY i'm not sure if it's correct but it's something like that

search is the table and inside that table there is a colum called rank with the other usuall stuff

and the business that bid the higher get's the rank to 1 so it would order the results acording to the rank so if a business has the rank 5 it has their product on the 5th result!!!!

i'm not sure if it would work well the order by part!!

Please Replie!!!

Is This A Good Question/Topic? 0
  • +

Replies To: Search engine bidding

#2 CTphpnwb   User is offline

  • D.I.C Lover
  • member icon

Reputation: 3839
  • View blog
  • Posts: 14,003
  • Joined: 08-August 08

Re: Search engine bidding

Posted 29 August 2009 - 05:06 PM

Are you looking for some one to write code for you? If so, this belongs in Post a Job. If not, then you should post code along with a specific question about it.

I believe that ORDER BY is increasing by default and INCREASING isn't a valid mysql command. You'd use DESC to reverse it.
Was This Post Helpful? 0
  • +
  • -

#3 Dannyboy997   User is offline

  • D.I.C Regular
  • member icon

Reputation: 64
  • View blog
  • Posts: 258
  • Joined: 17-April 09

Re: Search engine bidding

Posted 29 August 2009 - 07:49 PM

i figured it out here's my code for the search engine!!


Search.php

<?php
$connect = mysql_connect("localhost","root","") or die();
mysql_select_db("project");



//get data
$button = $_GET['submit'];
$search = $_GET['search'];
$id = $_GET['id'];
$id++;

if (!$button)
	echo "<font color='white'>You didn't submit a keyword.</font>";
	else
	{
	 if (strlen($search)<=2)
	 echo "<font color='white'>Search term too short.</font>";
	 else
	 {
	  echo "<font color='white'>You searched for <b>$search<b>- <a href='index.php'>Search Again:</a><hr size='1'></font>";
	  
	  


			
			$search_exploded = explode(" ",$search);
			
			foreach($search_exploded as $search_each)
			{
			//construct query
			 $x++;
			 if ($x==1)
				$construct .= " keywords LIKE '%$search_each%'";
				else
				$construct .="OR keywords LIKE '%$search_each%'";

			}
	//this is the order by part

		$construct = "SELECT * FROM orderby WHERE $construct ORDER BY rank";
	
	$run = mysql_query($construct);
	
	$foundnum = mysql_num_rows($run);
	
	if ($foundnum==0)
		echo "No results Found";
		else
		{
		echo "<font color='white'>$foundnum results found!<p></font><hr color='red'>";
		
		while ($runrows = mysql_fetch_assoc($run))
		{
		//get data
		$name = $runrows['name'];
		$desc = $runrows['description'];
		$url = $runrows['URL'];
		$date = $runrows['date'];
		$keywords = $runrows['keywords'];
		$rank = $runrows['rank'];
		
		
		//here is where it has like sponsored links at the top so the first 3 ranks get's picked the rest	is then placed after this
		if ($rank <4)
		{
		
		echo "
		<font size='5px'>
		<b>$rank</b>
		<b><a href='$url'>$name</a></b><br>
		</font>
		<font color='white' face='arial' size='2'>
		$desc<br>
		<font color='green'>http:// $url<p>
		</font>
		
		
		";
		}
		else
			{
			echo "<hr color='green'>
			<font color='red' face='arial'>
			<b><a href='$url'>$name</a></b><br>
			</font>
			<font color='white' face='arial' size='2'>
			$desc<br>
			<font color='green'>$url<p>
			</font>
		";
			
			}
		}
		}
	
	
	  
	  }
	  
  }

?>
<html>

<body bgcolor='grey'>


</body>


</html>




but i have another question i want to have the rank thing for the keywords chosen not all keywords??

how would i do this???
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1