TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
 
 
LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old 05-07-2009, 04:32 PM   #1 (permalink)
The Contributor
 
Join Date: May 2008
Posts: 36
Thanks: 5
Kay1021 is on a distinguished road
Help Removing Search Results from drop down

Hi i had a little question I was wondering someone might be able to answer. Right now i have a code that searches through the database and outputs results based on the search...then below I have a drop down menu that grabs data from the database to fill it. It works perfectly I was just wondering if there was a way that I could eliminate the first results from showing up in the drop down menu. I hope that made sense...i'll post the code that I have....any help is greatly appreciated.

PHP Code:
        /* Connect to database */
        
$con=mysql_connect(localhost"root""root");
        
mysql_select_db("db");
        
        if (!
$con)
                  {
             die(
'Could not connect: ' mysql_error());
              }
    
            
$sql "SELECT DISTINCT cat_name, postcode
                        FROM postalcode
            WHERE postcode = '
$postcode'
            AND status='sold'"
;

            
$qry mysql_query($sql);
        
            if (
mysql_num_rows($qry) > 0) {
                while (
$rs mysql_fetch_assoc($qry)) {
                         
$cat_name $rs['cat_name'];
                         
$postcode $rs['postcode'];
                         echo 
$rs['cat_name'] . '<br/>';
                }
            } else {
                print 
'no result found';
            }
            
            print 
'<form method="POST" action="index.php?ID=15">';
        
            
$query="SELECT DISTINCT cat_name 
                        FROM category 
                        GROUP BY cat_name"
;
                                
            
$result mysql_query ($query);
            echo 
"<select name=cat_name value=' '>";
            echo 
"<option value=''>View Available               
                        Categories</option>"
;
            while(
$nt=mysql_fetch_array($result))
                            {
                       echo 
"<option value=''>$nt[cat_name]</option>";
                }
            echo 
"</select><br/>";
                    
    
            print 
' <input type="submit" value="Contact Us for More 
                                  Information">
            </form>'


Thanks so much
Kay1021 is offline  
Reply With Quote
 



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

Advanced Search
Display Modes

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Help with Pagination of search results universalhope Advanced PHP Programming 5 09-01-2011 01:13 PM
Cleaning results from dict://dict.org/ sidisinsane General 0 08-26-2008 02:48 PM
Keyword Search Form Jako General 1 08-21-2008 07:44 AM
Building a MySQL search delayedinsanity MySQL & Databases 4 08-14-2008 04:21 AM
Outputting MySQL Results Andrew Advanced PHP Programming 5 01-13-2008 04:59 PM


All times are GMT. The time now is 10:42 PM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design