Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Display recent searches
Old 06-14-2009, 11:29 AM Display recent searches
Basti's Avatar
Average Talker

Posts: 22
Name: Sebastian
Location: Germany
Trades: 0
Hello everyone.

So i got Toplist, when a search is made through search.php it checks the database and looks throught my members description, titles etc and display results on a new page.
Guess thats how its always done :P

Ok, so i know there is some way to archive this, as ive seen it before, but i got no clue how.

How could i display, lets say the last 10 made search queries in my sidebar as links?

Does anyone know tutorials about this?
I asume i would need to save the query somehow in the database, maybe?

Help would be highly appreciated,
Thanks
__________________
Translations? English to German, drop me a Pm :: 0.03$ / word
Basti is offline
Reply With Quote
View Public Profile Visit Basti's homepage!
 
 
Register now for full access!
Old 06-14-2009, 04:43 PM Re: Display recent searches
Extreme Talker

Posts: 181
Name: David Jackson
Trades: 0
how familiar are you with PHP
__________________

Please login or register to view this content. Registration is FREE
davidj is offline
Reply With Quote
View Public Profile
 
Old 06-16-2009, 01:03 PM Re: Display recent searches
Basti's Avatar
Average Talker

Posts: 22
Name: Sebastian
Location: Germany
Trades: 0
Not that much really. I know to archieve php stuff from the script iam using, but php in general ( i guess the search things falls under it ), iam pretty useless there.

Seb
__________________
Translations? English to German, drop me a Pm :: 0.03$ / word
Basti is offline
Reply With Quote
View Public Profile Visit Basti's homepage!
 
Old 06-16-2009, 04:31 PM Re: Display recent searches
Extreme Talker

Posts: 181
Name: David Jackson
Trades: 0
It would take some time to write a solution for you and explain it in here especially for free (I'm guessing that's what you want)

your best bet is to start learning PHP so you can build your own solutions

If you want to learn i can help or there are loads of tutorials out there
__________________

Please login or register to view this content. Registration is FREE
davidj is offline
Reply With Quote
View Public Profile
 
Old 06-17-2009, 12:04 PM Re: Display recent searches
Basti's Avatar
Average Talker

Posts: 22
Name: Sebastian
Location: Germany
Trades: 0
Thx mate, but i need this now, learning stuff before is nogo for now.
Allready recieved a little help from which i can go further myself.

Thanks though.
__________________
Translations? English to German, drop me a Pm :: 0.03$ / word
Basti is offline
Reply With Quote
View Public Profile Visit Basti's homepage!
 
Old 06-20-2009, 08:56 PM Re: Display recent searches
Basti's Avatar
Average Talker

Posts: 22
Name: Sebastian
Location: Germany
Trades: 0
Hmm i got everything working, ( working, even though it spits out errors )

Someone know why these 2 errors show up? or how to fix it?

code
PHP Code:
$search_date time();
$result $DB->query("SELECT * FROM {$CONF['sql_prefix']}_search ORDER BY search_date DESC"__FILE____LINE__);
$rowtotal mysql_num_rows($result);
if (
$rowtotal >= 10) {
$DB->query("DELETE FROM {$CONF['sql_prefix']}_search WHERE search_date <= '$search_date' ORDER BY search_date ASC LIMIT 1");

$DB->query("INSERT INTO {$CONF['sql_prefix']}_search (search_query, search_text, search_date) VALUES ('{$TMPL['query']}', '{$TMPL['query']}', '{$search_date}')"__FILE____LINE__);
}

else {
$DB->query("INSERT INTO {$CONF['sql_prefix']}_search (search_query, search_text, search_date) VALUES ('{$TMPL['query']}', '{$TMPL['query']}', '{$search_date}')"__FILE____LINE__);
}

// End Recent Searches 
And this are the 2 errors, which are caused by the delete from line
PHP Code:
WarningMissing argument 2 for sql_mysql::query(), called in /home/anachron/public_html/sources/search.php on line 74 and defined in /home/anachron/public_html/sources/sql/mysql.php on line 42

Warning
Missing argument 3 for sql_mysql::query(), called in /home/anachron/public_html/sources/search.php on line 74 and defined in /home/anachron/public_html/sources/sql/mysql.php on line 42 
__________________
Translations? English to German, drop me a Pm :: 0.03$ / word

Last edited by Basti; 06-20-2009 at 08:57 PM..
Basti is offline
Reply With Quote
View Public Profile Visit Basti's homepage!
 
Old 06-20-2009, 10:52 PM Re: Display recent searches
NullPointer's Avatar
Will Code for Food

Posts: 2,815
Name: Matt
Location: Irvine, CA
Trades: 0
You call DB->query with three parameters except for in once case

Try:

PHP Code:
$search_date time();
$result $DB->query("SELECT * FROM {$CONF['sql_prefix']}_search ORDER BY search_date DESC"__FILE____LINE__);
$rowtotal mysql_num_rows($result);
if (
$rowtotal >= 10) {
$DB->query("DELETE FROM {$CONF['sql_prefix']}_search WHERE search_date <= '$search_date' ORDER BY search_date ASC LIMIT 1",__FILE____LINE__);

$DB->query("INSERT INTO {$CONF['sql_prefix']}_search (search_query, search_text, search_date) VALUES ('{$TMPL['query']}', '{$TMPL['query']}', '{$search_date}')"__FILE____LINE__);
}

else {
$DB->query("INSERT INTO {$CONF['sql_prefix']}_search (search_query, search_text, search_date) VALUES ('{$TMPL['query']}', '{$TMPL['query']}', '{$search_date}')"__FILE____LINE__);

__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
NullPointer is offline
Reply With Quote
View Public Profile Visit NullPointer's homepage!
 
Old 06-21-2009, 08:14 AM Re: Display recent searches
Basti's Avatar
Average Talker

Posts: 22
Name: Sebastian
Location: Germany
Trades: 0
Ha mate awsome, i didnt even noticed i forgot those file, line stuff

Thanks, working now.
__________________
Translations? English to German, drop me a Pm :: 0.03$ / word
Basti is offline
Reply With Quote
View Public Profile Visit Basti's homepage!
 
Reply     « Reply to Display recent searches
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.28070 seconds with 12 queries