[SOLVED] Search engine links

This is a discussion on "[SOLVED] Search engine links" within the PHP Forum section. This forum, and the thread "[SOLVED] Search engine links are both part of the Program Your Website category.



Go Back   Webforumz.com > Main Forums > Program Your Website > PHP Forum

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old Nov 22nd, 2007, 20:26
Reputable Member
Join Date: Oct 2007
Location: Liverpool UK
Age: 29
Posts: 216
Thanks: 0
Thanked 0 Times in 0 Posts
[SOLVED] Search engine links

Anyone now any good search engine tutorial websites??? I have never found it hard to find anythink on google butthis has put me through my paces!

I have found a few and there is either a bit of code with no form, or loads of code without the use of lamens terms & still no form, just a good old tutorial...

Alex geek sent me a good one, but i found it a little bit difficult to understand, there was no form or database to give me a idea of how it works!!

Any help would be great!!!
Reply With Quote

  #2 (permalink)  
Old Nov 22nd, 2007, 20:39
Marc's Avatar
Moderator

SuperMember
Join Date: Apr 2007
Location: Scotland, UK
Age: 15
Posts: 1,650
Thanks: 0
Thanked 8 Times in 8 Posts
Send a message via MSN to Marc Send a message via Skype™ to Marc
Re: Search engine links

I found this: http://www.roscripts.com/PHP_search_engine-119.html useful. Hope you do too.
Reply With Quote
  #3 (permalink)  
Old Nov 22nd, 2007, 20:56
SuperMember

SuperMember
Join Date: May 2007
Location: UK
Age: 27
Posts: 1,111
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Search engine links

I've never understood why you would write your own search engine, when you can just use Google CSE.

You're most unlikely to create as effective a search engine as Google.
Reply With Quote
  #4 (permalink)  
Old Nov 22nd, 2007, 21:04
alexgeek's Avatar
Technical Administrator

SuperMember
Join Date: Jul 2007
Location: Webforumz 24/7
Age: 15
Posts: 3,770
Blog Entries: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to alexgeek
Re: Search engine links

Because google's search engine can take days to index a new page.
Last Blog Entry: 3D Chess in your browser! (Mar 14th, 2008)
Reply With Quote
  #5 (permalink)  
Old Nov 22nd, 2007, 21:11
SuperMember

SuperMember
Join Date: May 2007
Location: UK
Age: 27
Posts: 1,111
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Search engine links

Quote:
Originally Posted by alexgeek View Post
Because google's search engine can take days to index a new page.
And you can't wait that long?

I suppose this could be important for large news sites, but most people can surely wait a few days.
Reply With Quote
  #6 (permalink)  
Old Nov 22nd, 2007, 21:17
alexgeek's Avatar
Technical Administrator

SuperMember
Join Date: Jul 2007
Location: Webforumz 24/7
Age: 15
Posts: 3,770
Blog Entries: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to alexgeek
Re: Search engine links

Me personally? Nope. I'd rather do the search function myself and it be there as soon as I post it.
Plus this is experience!
Last Blog Entry: 3D Chess in your browser! (Mar 14th, 2008)
Reply With Quote
  #7 (permalink)  
Old Nov 22nd, 2007, 21:33
SuperMember

SuperMember
Join Date: May 2007
Location: UK
Age: 27
Posts: 1,111
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Search engine links

Perhaps if I were skilful with PHP, I'd see this differently.

But in any case, I'd trust Google to do a much better job than I ever could.
Reply With Quote
  #8 (permalink)  
Old Nov 22nd, 2007, 21:34
Reputable Member
Join Date: Oct 2007
Location: Liverpool UK
Age: 29
Posts: 216
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Search engine links

Hey thanks guys, i had a bit of a moan on my last post & felt a little ashamed when i re-read it today, i have put myself through stress trying to learn two quickly!

I hope you all accept my appologies, am normally a very placid fella, thank you everyone for your help!!
Reply With Quote
  #9 (permalink)  
Old Nov 22nd, 2007, 21:53
Reputable Member
Join Date: Oct 2007
Location: Liverpool UK
Age: 29
Posts: 216
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Search engine links

Cheers Ad-wrock for the help but the link is the same one Alex sent me, am abit unsure of what to do with the tutorial found on the link:

Is there a form to go with it Adrock/Alex?

What type of database does it require to use it? I heard that MYISAM database needs to be used when u make use of a search engine is this wrong?

Why couldnt the man who madethe tutorial provide a form & databse for novice learners to go with the code explanation.

I agree with Alex geek about the google search engine, i heardthere is a possible privacy factor involved when using there search engine, besides i only like using what i have created.
Reply With Quote
  #10 (permalink)  
Old Nov 23rd, 2007, 09:03
SuperMember

SuperMember
Join Date: May 2007
Location: UK
Age: 27
Posts: 1,111
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Search engine links

Quote:
Originally Posted by longstand View Post
i heardthere is a possible privacy factor involved when using there search engine
To use Google's search engine, you must allow it to index your pages. If for some reason you exclude it or it can't access the page (such as a secure page), then obviously the search won't find the page.

Other than that, Google will be indexing your pages anyway; that's how people find your website! So what's the privacy issue?
Reply With Quote
  #11 (permalink)  
Old Nov 23rd, 2007, 11:28
Reputable Member
Join Date: Oct 2007
Location: Liverpool UK
Age: 29
Posts: 216
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Search engine links

Google are a very nosy franchise m8t, but i get your drift, at least you tried to help & repleyed! have you noticed this forum is turning into tit for tat argument zone for smarty pants fighting to be the top geek?

You post a question and get email disturbed in the hope that someone has help for your problem, and it just turns out to be anouher let down of tit 4 tat bithing between other members.. Its not right i say

I used to love this forum when i first joined, infact i learnt load from it, especially from Rakuli,

Dont no whats going on here latley do...
Reply With Quote
  #12 (permalink)  
Old Nov 23rd, 2007, 12:05
SuperMember

SuperMember
Join Date: Jun 2007
Location: uk
Posts: 459
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Search engine links

didnt you have any joy with the script I sent you.
Reply With Quote
  #13 (permalink)  
Old Nov 23rd, 2007, 12:40
Reputable Member
Join Date: Oct 2007
Location: Liverpool UK
Age: 29
Posts: 216
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Search engine links

Yer i got it working thanks again for that mate, just had problems optimising the results to display a little better!!!
Reply With Quote
  #14 (permalink)  
Old Nov 23rd, 2007, 16:27
Reputable Member
Join Date: Oct 2007
Location: Liverpool UK
Age: 29
Posts: 216
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Search engine links

For anyone needing a php search engine to adapt from with the form, so you can get to grips with how it all works then here it is.

This search engine was built by myself & the very helpfull dab42pat, i hope this helps someone out


Search engine & form below:

PHP: Select all

<?php
mysql_connect
('localhost''root''your password goes here');
if (
mysql_errno()) {
    
trigger_error('Couldn\'t select database - '.mysql_error());
}
mysql_select_db('dbsignup');
if (
mysql_errno()) {
    
trigger_error('Couldn\'t select database - '.mysql_error());
}
$searchSubmitted false;
if (
$_SERVER['REQUEST_METHOD'] == 'POST')
{
    
$searchSubmitted true;
    
    
$criteria = array();
    
    if (!empty(
$_POST['gender'])) {
        
// Gender selected - gender is a string
        
$criteria[] = 'gender = \''.mysql_real_escape_string($_POST['gender']).'\'';
    }
    
    if (!empty(
$_POST['age'])) {
        
// Age selected - age can only be a number
        
$criteria[] = 'age = '.((int) $_POST['age']);
    }
    
    if (!empty(
$_POST['height_one']) && !empty($_POST['height_two'])) {
        
// Both height_one and height_two are selected
        
$criteria[] = 'age BETWEEN '.((int) $_POST['height_one']).' AND '.$_POST['height_two'];
    } else if (!empty(
$_POST['height_one'])) {
        
// Only height_one was selected
        
$criteria[] = 'age >= '.((int) $_POST['height_one']);
    } else if (!empty(
$_POST['height_two'])) {
        
// Only height_two was selected
        
$criteria[] = 'age <= '.((int) $_POST['height_two']);
    }
    
    
$sql 'SELECT * FROM customer';
    
    if (
count($criteria) > 0) {
        
// Only add a where clause if some criteria have been selected.
        // If no criteria are selected, show all results.
        
$sql .= ' WHERE ('.implode(') AND ('$criteria).')';
    }
    
    
// This is for debugging - remove it when you're happy with how things work
    
print '<pre>'.htmlspecialchars($sql).'</pre>';
    
    
$result mysql_query($sql);
    
    if (
mysql_errno()) {
        
trigger_error('Query failed - '.mysql_error(), E_USER_ERROR);
    }
    
    
$customers = array();
    while (
$customer mysql_fetch_assoc($result)) {
        
$customers[] = $customer;
    }
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
    <head>
        <meta http-equiv="Content-type" content="text/html; charset=utf-8">
        <title>Test</title>
    </head>
        <body>
            <form method="post">
                <p>
                    Gender:
                    <select name="gender">
                        <option value="">(either)</option>
                        <option>Male</option>
                        <option>Female</option>
                    </select>
                </p>
                <p>
                    Age:
                    <select name="age">
                        <option value="">(any)</option>
                        <option>18</option>
                        <option>19</option>
                        <option>20</option>
                        <option>21</option>
                        <option>22</option>
                        <option>23</option>
                        <option>24</option>
                        <option>25</option>
                        <option>26</option>
                        <option>27</option>
                        <option>28</option>
                        <option>29</option>
                    </select>
                </p>
                <p>
                    Height:
                    <select name="height_one">
                        <option value="">(any)</option>
                        <option>1</option>
                        <option>2</option>
                        <option>3</option>
                        <option>4</option>
                    </select>
                    to
                    <select name="height_two">
                        <option value="">(any)</option>
                        <option>1</option>
                        <option>2</option>
                        <option>3</option>
                        <option>4</option>
                    </select>
                </p>
                <p>
                    <input type="submit" value="Search" />
                </p>
            </form>
            <?php if ($searchSubmitted): ?>
                <?php if (count($customers) == 0): ?>
                    <p>
                        Sorry, no customers were found for your search. Try altering your search options.
                    </p>
                <?php else: ?>
                    <table>
                        <?php foreach ($customers as $customer): ?>
                            <tr>
                                <td><?php echo htmlspecialchars($customer['first_name']); ?>
                                <td><?php echo htmlspecialchars($customer['age']); ?>
                            </tr>
                        <?php endforeach; ?>
                    </table>
                <?php endif; ?>
            <?php endif; ?>
        </body>
    </head>
</html>

Here is the database i used to:

CREATE DATABASE IF NOT EXISTS dbsignup;
USE dbsignup;
CREATE TABLE `customer` (`customer_id` INT( 3 ) NOT NULL
AUTO_INCREMENT,
`first_name` VARCHAR(30) NOT NULL ,
`last_name` VARCHAR(30) NOT NULL ,
`address` VARCHAR(70) NOT NULL ,
`city` VARCHAR(40) NOT NULL ,
`area` VARCHAR(50) NOT NULL ,
`email` VARCHAR(70) NOT NULL ,
`phone` int(20) NOT NULL ,
`user_name` VARCHAR(30) NOT NULL ,
`password` VARCHAR(30) NOT NULL ,
`work_location` VARCHAR(60) NOT NULL ,
`agency_name` VARCHAR(70) NOT NULL ,
`agency_number` VARCHAR(30) NOT NULL ,
`skills` VARCHAR(500) NOT NULL ,
`about_me` VARCHAR(500) NOT NULL ,
`myspace_address` VARCHAR(50) NOT NULL ,
`hotmail_yahoo_address` VARCHAR(50) NOT NULL ,
`gender` VARCHAR(10) NOT NULL ,
`age` VARCHAR(3) NOT NULL ,
`height_one` int(20) NOT NULL ,
`height_two` int(20) NOT NULL ,
`build` VARCHAR(20) NOT NULL ,
`eye_colour` VARCHAR(20) NOT NULL ,
`hair_colour` VARCHAR(30) NOT NULL ,
`desired_work` VARCHAR(100) NOT NULL ,
`image_one` VARCHAR(10) NOT NULL ,
`image_two` VARCHAR(10) NOT NULL ,
`image_three` VARCHAR(10) NOT NULL ,
`image_four` VARCHAR(10) NOT NULL , UNIQUE ( `customer_id` ) );


Cheers!
Reply With Quote
  #15 (permalink)  
Old Nov 23rd, 2007, 20:36
c010depunkk's Avatar
SuperMember

SuperMember
Join Date: Apr 2007
Location: Willich, Germany
Age: 20
Posts: 593
Blog Entries: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to c010depunkk
Re: [SOLVED] Search engine links

Well done, longstand! Sorry if we weren't so helpful at times. But the best way to learn is to do it yourself....

Thanks 4 posting your solution!
Reply With Quote
  #16 (permalink)  
Old Nov 23rd, 2007, 20:40
Reputable Member
Join Date: Oct 2007
Location: Liverpool UK
Age: 29
Posts: 216
Thanks: 0
Thanked 0 Times in 0 Posts
Re: [SOLVED] Search engine links

No problem,

Take Care,

Reply With Quote
Reply

Thread Tools

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 On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Search Engine Help Dogcheese Search Engine Optimization (SEO) 25 Dec 2nd, 2007 21:19
Search engine help icepick Search Engine Optimization (SEO) 12 May 18th, 2007 19:51
Search Analyst/Account Executive/SEO/PPC/CPC/Search Engine Optimisation/Pay per Click/London Web JobBot Job Opportunities 0 Nov 22nd, 2006 10:20
SEO/PPC/Search Engine Optimisation/Pay Per Click/Campaigns/Online/Marketing/Agency/Analyst/Search/Manager/Executive/Manchester Web JobBot Job Opportunities 0 Nov 17th, 2006 11:11
hello everyone . search engine help? zifzaf Introduce Yourself 4 Nov 10th, 2005 09:25


All times are GMT. The time now is 05:42.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43