NamePros
Welcome, Guest! Ready to make a name for yourself in the domain business? We welcome both the hobbyist and professional domainer to join the discussion as part of the NamePros community.

Click here to create your profile to start earning reputation for posting, and trader ratings for buying & selling in our free e-marketplace. Build your trader rating with each successful sale. Our system has tracked over 100,000 sales and counting!
FAQ & TOS Register Search Today's Posts Mark Forums Read

Go Back   NamePros.com > Website Development Discussion Forums > Programming
Reload this Page Recordset for simple search engine in PHP

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.

Advanced Search


Closed Thread
 
LinkBack Thread Tools
Old 09-19-2005, 10:02 AM THREAD STARTER               #1 (permalink)
NamePros Member
Join Date: Feb 2005
Posts: 58
RichardAFCB is an unknown quantity at this point
 



Recordset for simple search engine in PHP


Hi there,

I'm trying to create a simple search engine for a client so that customers can search his products. I have one field for text, and another with a drop down list of product types and an "All Items" option.

I've got my recordset to display search results matching the text field and the products, but I can't get it to display All Items if the customer selects that! So basically they can search by product type, but not across all the products.
????: NamePros.com http://www.namepros.com/programming/124994-recordset-for-simple-search-engine-php.html

I'm doing this in Dreamweaver. My actual PHP coding knowledge is...terrible!

Here is my code:

<?php
$colname2_products = "-1";
if (isset($_POST['type'])) {
$colname2_products = (get_magic_quotes_gpc()) ? $_POST['type'] : addslashes($_POST['type']);
}
$colname_products = "-1";
if (isset($_POST['searchterm'])) {
$colname_products = (get_magic_quotes_gpc()) ? $_POST['searchterm'] : addslashes($_POST['searchterm']);
}
mysql_select_db($database_kofightposters, $kofightposters);
$query_products = sprintf("SELECT * FROM products WHERE name LIKE '%%%s%%' AND type = '%s' ORDER BY name ASC ", $colname_products,$colname2_products);
$products = mysql_query($query_products, $kofightposters) or die(mysql_error());
$row_products = mysql_fetch_assoc($products);
$totalRows_products = mysql_num_rows($products);
?>

Any help would be greatly appreciated!

Cheers,

Rich
RichardAFCB is offline  
Old 09-19-2005, 03:38 PM THREAD STARTER               #2 (permalink)
NamePros Member
Join Date: Feb 2005
Posts: 58
RichardAFCB is an unknown quantity at this point
 



Anybody?
RichardAFCB is offline  
Old 09-19-2005, 05:08 PM   #3 (permalink)
Senior Member
Join Date: Sep 2005
Location: NC
Posts: 2,323
lilgee is a name known to alllilgee is a name known to alllilgee is a name known to alllilgee is a name known to alllilgee is a name known to alllilgee is a name known to alllilgee is a name known to alllilgee is a name known to all
 



All of the stuff is post to be in one field. You didnt post this in the right place
__________________
Sharing 50% profit for helping to sell on ebay. PM me for more info.
lilgee is offline  
Old 09-19-2005, 06:19 PM THREAD STARTER               #4 (permalink)
NamePros Member
Join Date: Feb 2005
Posts: 58
RichardAFCB is an unknown quantity at this point
 



That makes no sense to me....
RichardAFCB is offline  
Old 09-20-2005, 08:44 AM THREAD STARTER               #5 (permalink)
NamePros Member
Join Date: Feb 2005
Posts: 58
RichardAFCB is an unknown quantity at this point
 



Anybody?
RichardAFCB is offline  
Old 09-20-2005, 10:11 AM   #6 (permalink)
NamePros Member
 
yz0rx's Avatar
Join Date: Oct 2004
Posts: 98
yz0rx is an unknown quantity at this point
 



I'm a little confused. You have a search form with a drop down selection of categories and a search box for keywords? When people search by selecting a category, you want the results from that category only, unless they select the All Items category?
yz0rx is offline  
Old 09-20-2005, 11:48 AM THREAD STARTER               #7 (permalink)
NamePros Member
Join Date: Feb 2005
Posts: 58
RichardAFCB is an unknown quantity at this point
 



Fixed now!

Cheers,

Rich
RichardAFCB is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
Googlism - What does google think of you? deadserious The Break Room 55 12-15-2005 10:09 AM
GP0.com Taking Offers .X. Domains For Sale - Make Offer 4 08-16-2005 09:56 PM
Search Engine Submission Webtwink For Sale / Advertising Board 7 08-27-2003 05:54 AM

Liquid Web Smart Servers  
All times are GMT -7. The time now is 10:26 AM.

Managed Web Hosting by Liquid Web
Domain name forum recommended by Domaining.com Powered by: vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.6.0 Ad Management plugin by RedTyger