[SOLVED] Search engine [NEED HELP]

10-19-08, 12:58 PM
|
|
Newbie Coder
|
|
Join Date: Oct 2008
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
|
[SOLVED] Search engine [NEED HELP]
Okay, my search engine is really bad.
Dont know why, but my host is sending me mails about that my search engine, has slow mysql query, and it's slowing the server, so other users get mysql errors.
And I don't know how to do a table layout to it, so it looks good.
Because ive tryed, but it always seems bad, because the table, isnt 1 table for all of the items the search found, it's one seperate table for each result it found.
So I need your help, to optimize my mysql query, so it becomes fast, and the layout.
Thanks
EDIT:
Bad painting, about how the layout looks like.
example.jpg
Last edited by Kadir Özüak; 10-19-08 at 01:06 PM.
|

10-19-08, 01:36 PM
|
|
Wannabe Coder
|
|
Join Date: Jul 2008
Location: Somerset UK!
Posts: 192
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Not to sure about the query but with the table you should try this.
To zebra colour the rows use an if statment where if num_rows %2 == 0 is equal.
|

10-19-08, 02:40 PM
|
|
Newbie Coder
|
|
Join Date: Oct 2008
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
|
|

10-19-08, 02:54 PM
|
|
Newbie Coder
|
|
Join Date: Oct 2008
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
I really preciate your help in here.
It helped me, thank you.
Just had to change a few things, to get it work probebly(spell?)
By the way, how can I set the widht of the Item ID table border?
|

10-19-08, 03:02 PM
|
 |
Community Leader
|
|
Join Date: Sep 2005
Location: Spain
Posts: 8,075
Thanks: 11
Thanked 88 Times in 83 Posts
|
|
Quote:
Originally Posted by Kadir Özüak
probebly(spell?) 
|
Properly. 
|

10-19-08, 04:05 PM
|
|
Newbie Coder
|
|
Join Date: Oct 2008
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
By the way, any suggestions to how I would do the mysql query fast?
Because my host will delete my account soon, for the slow mysql query, and that it's giving others of the same server, some mysql errors, and lagness.
By the way, I figured out the width thingy 
Also, how would I make that it wouldnt search for keywords, and just search for the whole post.
Now if I type: Cooking gloves
It would get some cooking stuff, and some gloves stuff, keywords.
I want it to be like, if I type Cooking gloves, it only displays the Cooking gloves.
Any idea?
UPDATED CODE:
Last edited by Kadir Özüak; 10-19-08 at 04:13 PM.
|

10-20-08, 07:47 AM
|
|
Newbie Coder
|
|
Join Date: Oct 2008
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
PROBLEM!
The code ianbrind gave me, isnt displaying the first thing.
Like if I searched for fish, and there came up Pike and Salmon with the old table engine, then with the one ianbrind gave, it would only give salmon.
How to fix?
|

10-20-08, 09:49 AM
|
 |
Junior Code Guru
|
|
Join Date: May 2006
Posts: 555
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
This is what is causing the slow mysql query problem:
1. Create an index for ItemID
2. Create an index for ItemName
3. Change your query. Using '*" in your query is greedy! Something like this is a lot better:
__________________
Whatever you decide, you should make sure best security methods are used and practiced. Should you really need more help, PM me.
|

10-20-08, 10:48 AM
|
|
Newbie Coder
|
|
Join Date: Oct 2008
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
How do I create index for ItemId and ItemName?
Or did you index it, in the code you posted.
|

10-20-08, 11:38 AM
|
|
Newbie Coder
|
|
Join Date: Oct 2008
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Sorry for double posting, but it seems I cant edit my post.
Anyway, the post you posted, with the mysql slow query fix, isn't giving any results.
EDIT: It is working, but is searching for full text. So it doesnt search for keywords anymore.
I want it to search for keywords, only. Because if I type Water it can't find the word Watermelon in the database.
Last edited by Kadir Özüak; 10-20-08 at 11:41 AM.
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
|
|
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|