Closed Thread
Results 1 to 2 of 2

Thread: Search Results Urgent

  1. #1
    hitman123 is offline Newbie
    Join Date
    Jul 2009
    Posts
    11
    Rep Power
    0

    Search Results Urgent

    I have created a search box which potentially works. But I wish to insert the results in to the text box rather than having them on the page. I've been working on this for literally 3 days but getting no where, please help.

    I have a text box and a search button next to it. so When I put in a search and click search, the results should appear in the ref text box. I hope you understand what I mean. Please Help. Here is the code:


    Code:
    <form action="test_search.php" method="get">
    <input type="text" name="query" id="query" size="40" value="" action="Search.php" columns="2" autocomplete="off" delay="1500"> 
    <input type="submit" value="Search">
    <input type="hidden" name="search" value="1">
    </form>
    <center></center>
    </div>
    <p>&nbsp;</p>
    
    <?
    $myServer = '*****';
    $myUser = '****';
    $myPass = '*****'; 
    $myDB = '*******';
    $SpecRef = $_GET['query'];
    print ("$SpecRef");
    
    
    
    //connection to the database
    $dbhandle = mssql_connect($myServer, $myUser, $myPass)
    or die("Couldn't connect to SQL Server on $myServer");
    
    
    
    //select a database to work with 
    $selected = mssql_select_db($myDB, $dbhandle)
    or die("Couldn't open database $myDB");
    //error message (not found message)begins 
    $XX = "No Matches Found"; 
    //query details table begins
    $query = ("SELECT * FROM ******** WHERE Spec_Ref LIKE'$SpecRef%' "); 
    // $query = ("SELECT * FROM *******");
    
    print(' is what you searched for:');
    
    
    //execute the SQL query and return records
    $result = mssql_query($query);
    
    $numRows = mssql_num_rows($result);
    echo "<h1>" . $numRows . " Record" . ($numRows == 1 ? "" : "s") . " Found </h1>";
    
    //display the results
    echo '<textarea>'; 
    while($row = mssql_fetch_array($result)) 
    {
    echo $row["Spec_Ref"] . "\n"; }
    echo '</textarea>'; 
    //close the connection 
    mssql_close($dbhandle); 
    //display the results
    while($row = mssql_fetch_array($result))
    {
    echo "<li>" . $row["Spec_Ref"] . "</li>"; 
    }
    //close the connection
    mssql_close($dbhandle);
    
    //textareaContent = "";
    
    //while ($row = @mysql_fetch_array($query))
    //{
    //$var1=$row["Player"];
    //$var2=$row["Avg"];
    //$var3=$row["HR"];
    //$var4=$row["RBI"];
    
    $textareaContent .= "Spec Ref: $var1 Avg: $var2 HR: $var3 RBI $var4 <br/>";
    //}
    
    //if (!isset($var1) || $var1=="") {
    //echo $XX;
    //}
    
    ?>
    Last edited by Orjan; 07-21-2009 at 05:22 AM. Reason: Please use code tags

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Posts
    Many

     
  3. #2
    Join Date
    Sep 2008
    Location
    Australia
    Posts
    4,834
    Blog Entries
    10
    Rep Power
    51

    Re: Search Results Urgent

    Didn't you get help for this already... Why did you create the thread again?
    jQuery Selectors Tutorial - jQuery Striped Table tutorial - jQuery Events - jQuery Validation
    Sorry if I don't post as often as I did, I'll try to get here as much as possible! I'm working my bum off to get this scholarship and other stuff!

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 2
    Last Post: 09-27-2011, 09:12 PM
  2. Replies: 4
    Last Post: 09-15-2010, 06:19 AM
  3. Combine Different Sites Search Results
    By ybc in forum HTML Programming
    Replies: 2
    Last Post: 08-12-2010, 09:36 AM
  4. Search Box Urgent
    By hitman123 in forum PHP Development
    Replies: 11
    Last Post: 08-11-2009, 01:43 AM
  5. Google Search Engine Sub-Results
    By twalters84 in forum Search Engines
    Replies: 11
    Last Post: 12-11-2008, 03:27 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts