SunQuest
           Tutorials
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsOtherTutorials

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old November 4th, 2005, 04:18 PM
Foddski Foddski is offline
Contributing User
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Stoke On Trent, England
Posts: 166 Foddski User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 14 h 17 m 54 sec
Reputation Power: 2
Matt Wade's Search Engine Tutorial

Having a few problems with this, can't get my head round the following part of the code
php Code:
Original - php Code
  1. <?php
  2. require('dbclass.php');
  3.  
  4. class Search {
  5.  
  6.     var $_db;
  7.     var $_searchterms;
  8.     var $_numterms;
  9.  
  10.     function Search($keywords) {
  11.         $this->_db = new DB_Class($dbname, $username, $password);
  12.         if (!get_magic_quotes_gpc()) {
  13.             $keywords = addslashes ($keywords);
  14.         }
  15.         $this->_searchterms = explode(' ', $keywords);
  16.         $this->_numterms = count($this->_searchterms);
  17.     }

I get this result
Notice: Undefined variable: dbname in c:inetpubwwwrootdomainsearchsearchclass.php on line 13

Notice: Undefined variable: username in c:inetpubwwwrootdomainsearchsearchclass.php on line 13

Notice: Undefined variable: password in c:inetpubwwwrootdomainsearchsearchclass.php on line 13
I have even included the variables here eg
php Code:
Original - php Code
  1. <?php
  2. require('dbclass.php');
  3. $username="123";
  4. $password="123";
  5. $dbname="123";
  6. class Search {
  7.  
  8.     var $_db;
  9.     var $_searchterms;
  10.     var $_numterms;
  11.  
  12.     function Search($keywords) {
  13.         $this->_db = new DB_Class($dbname, $username, $password);
  14.         if (!get_magic_quotes_gpc()) {
  15.             $keywords = addslashes ($keywords);
  16.         }
  17.         $this->_searchterms = explode(' ', $keywords);
  18.         $this->_numterms = count($this->_searchterms);
  19.     }


But I still get the same errors.
Any thoughts people
TIA

Reply With Quote
  #2  
Old November 4th, 2005, 06:14 PM
brut brut is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 367 brut User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 m 30 sec
Reputation Power: 2
RE: Matt Wade's Search Engine Tutorial

Define your variables inside the class.
php Code:
Original - php Code
  1.  
  2. <?php
  3. require('dbclass.php');
  4.  
  5. class Search {
  6.  
  7.     var $username="123";
  8.     var $password="123";
  9.     var $dbname="123";
  10.     var $_db;
  11.     var $_searchterms;
  12.     var $_numterms;
  13.  
  14.     function Search($keywords) {
  15.         $this->_db = new DB_Class($dbname, $username, $password);
  16.         if (!get_magic_quotes_gpc()) {
  17.             $keywords = addslashes ($keywords);
  18.         }
  19.         $this->_searchterms = explode(' ', $keywords);
  20.         $this->_numterms = count($this->_searchterms);
  21.     }

Reply With Quote
  #3  
Old November 5th, 2005, 08:07 AM
Foddski Foddski is offline
Contributing User
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Stoke On Trent, England
Posts: 166 Foddski User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 14 h 17 m 54 sec
Reputation Power: 2
RE: Matt Wade's Search Engine Tutorial

Thanks for the reply, unfortunately that made no difference

Any other suggestions please

Reply With Quote
  #4  
Old November 5th, 2005, 09:30 AM
System System is offline
Codewalkers Novice (500 - 999 posts)
 
Join Date: Apr 2007
Posts: 665 System User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
Message Moved

Thread moved from 'PHP Coding' to 'Tutorials' by andrew.

Reason: should be here i think

Reply With Quote
  #5  
Old November 5th, 2005, 09:33 AM
Foddski Foddski is offline
Contributing User
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Stoke On Trent, England
Posts: 166 Foddski User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 14 h 17 m 54 sec
Reputation Power: 2
RE: Matt Wade's Search Engine Tutorial

I don't see the point of that, it is a coding issue I am having problems with.

Couldn't even find this part of the forum without the email link

I'd never have looked here to help anyone

Reply With Quote
  #6  
Old December 22nd, 2005, 03:41 PM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 24
RE: Matt Wade's Search Engine Tutorial

ujjjj

Reply With Quote
Reply

Viewing: Codewalkers ForumsOtherTutorials > Matt Wade's Search Engine Tutorial


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway