473,387 Members | 1,520 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

how to code a search engine for date??

127 100+
Emm.. I have done search engine for a job portal, if i want to a list menu for date posted as below, what code sql query should i needed??

List menu
Date Posted:
1 day ago
1 week ago
2 week ago
All

And what code or sql query for 'All'???

Thanks..:)
Feb 4 '07 #1
5 1902
Motoma
3,237 Expert 2GB
Emm.. I have done search engine for a job portal, if i want to a list menu for date posted as below, what code sql query should i needed??

List menu
Date Posted:
1 day ago
1 week ago
2 week ago
All

And what code or sql query for 'All'???

Thanks..:)
Why SQL flavor are you using?
Feb 4 '07 #2
bb nicole
127 100+
Why SQL flavor are you using?
Emm... Sorry.. What do u means?? I have complete the code as below, but i have no idea how to add a search function for date the job posted by employer, because the date posted inserted in database is a dd mm yyyy, not like below...
1 day ago
1 week ago
2 week ago


[PHP]<?php
mysql_connect("localhost","root","")
or die("Cannot connect to the server");

mysql_select_db("ums e-job portal")
or die("Cannot connect to the database");

if (isset($_POST['keyword'])) {
$keyword = mysql_real_escape_string($_POST["keyword"]);
$jobCategory=$_POST["jobCategory"];
$jobLocation=$_POST["jobLocation"];

$sql="SELECT * FROM job WHERE jobCategory LIKE '$jobCategory' AND jobLocation LIKE '$jobLocation' AND jobTitle like '%$keyword%' AND jobType LIKE '%$keyword%'OR jobPosition LIKE'%$keyword%'OR companyName LIKE '%$keyword%' ";
?>[/PHP]
Feb 5 '07 #3
Motoma
3,237 Expert 2GB
I have moved this thread to the MySQL forum, the folks there should be much more helpful.
Feb 5 '07 #4
ronverdonk
4,258 Expert 4TB
I have the distinct feeling, from all your previous threads in both the PHP and the MySQL forums, that you could do with some MySQL tutorials and I'd suggest that you do that before you continue.

Fort this question, it can all be found in the standard MySQL documentation. I'll give 1 example. To calculate the date for 1 day, 1 week and 2 weeks ago from a given date in format 'dd-mm-yyyy'you issue the following SQL statements:
Expand|Select|Wrap|Line Numbers
  1. // since 1 day
  2. SELECT DATE_SUB(STR_TO_DATE(column_name, '%d-%m-%Y'), INTERVAL 1 DAY) as dayminus1;
  3.  
  4. // since 7 days
  5. SELECT DATE_SUB(STR_TO_DATE(column_name, '%d-%m-%Y'), INTERVAL 1 WEEK) as weekminus1;
  6.  
  7. // since 2 weeks
  8. SELECT DATE_SUB(STR_TO_DATE(column_name, '%d-%m-%Y'), INTERVAL 2 WEEK) as weekminus2;
Ronald :cool:
Feb 5 '07 #5
lachu
1
I have done search engine for a job portal, if i want to a list menu for date posted as below, what code sql query should i needed??

List menu
Date Posted:
1 day ago
1 week ago
2 week ago
All

And what code or sql query for 'All'???

Thanks..:)[/quote]
Apr 17 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Frank | last post by:
Hello, I'm running a site with +20.000 articles. The articles (html files) are saved on the server as txt files. Alle other data (author, date, category and so on) are in a MySQL db. Before we...
5
by: George | last post by:
Hi, Anyone has the background for explaining? I have made a search on my name and I have got a link to another search engine. The link's title was the search phrase for the other search engine...
8
by: Stromboli | last post by:
Hi, I have my site available in a couple of languages most of the files are indexf.html (french), indexi.html (italian) and indexde.html (german).. I'd like to start using multiviews but I've...
2
by: Patrick | last post by:
Are the differences between a search engine, a subject directory and a meta search engine significant for an ebusiness web site owner? A meta search engine merely uses ordinary existing search...
39
by: Noticedtrends | last post by:
Can inference search-engines narrow-down the number of often irrelevant results, by using specific keywords; for the purpose of discerning emerging social & business trends? For example, if...
67
by: Sandy.Pittendrigh | last post by:
Here's a question I don't know the answer to: I have a friend who makes very expensive, hand-made bamboo flyrods. He's widely recognized (in the fishing industry) as one of the 3-5 'best' rod...
83
by: D. Dante Lorenso | last post by:
Trying to use the 'search' in the docs section of PostgreSQL.org is extremely SLOW. Considering this is a website for a database and databases are supposed to be good for indexing content, I'd...
0
by: Mark Jones | last post by:
Search Engine Cloaker is used by hundreds of top-ranked Webmasters to increase their search engine listings. How it works: Cloaker tricks the search engine spiders into thinking your site...
3
by: Michael Fesser | last post by:
..oO(Jerry Stuckle) I prefer third-party search engines or my own. A simple index-based engine with ranking is not that hard to write. Of course it's not that powerful than a professional...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.