Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8324695
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T00:09:57+00:00 2026-06-09T00:09:57+00:00

How is that possible to show sphinx search result via PHP i have installed

  • 0

How is that possible to show sphinx search result via PHP
i have installed sphinx and configured but i am unable to get the result via PHP

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T00:09:59+00:00Added an answer on June 9, 2026 at 12:09 am

    The Below Code Is Used To Get The Full Content From Sphinx Search Result
    Now Currently We Need To Give The Id In $SQL line

    <?php
    echo "Welcome To Sphinx Search Site </br>";
    $q = "html";
    $sphx = sphinx_search("html", 0, 20);
    $sphx['122'];
    
    
    $ids = 122;
    
    $sql =  "SELECT post_title , post_content FROM wp_posts WHERE  ID = '122'";
    db();
    
    if(  !($r = mysql_query($sql)))
        die("[MYSQL]".mysql_error() . mysql_errno() );
    
    $max = $sphx['total'];
    $num_rows = $sphx['docs'];
    
    echo "<b>Displaying {$num_rows} results of {$max}</b><br /><br />";
    
    while($row = mysql_fetch_assoc($r) ) {
        echo "{$row['post_title']} <br />{$row['post_content']}<br /><hr />";    
        }
    mysql_free_result($r);
    
    /*
     * SPHINX Search
     */
    
    /*
     * Search sites by Keywords using sphinx; with an option to search sites tags only
     * @param string $q te keyword
     * @param int $i id of the first result to return
     * @param int $max max results to return
     * @param bollen $url set to true to return matches from the 'url' column only
     *
     * @return string $ids comma seperated list of ids
     */
    function sphinx_search($q, $i, $limit, $post_type=true){
            require_once 'sphinxapi.php';
    
            $ids = '33500';
    
            $cl = new SphinxClient();
            $cl->SetServer( "192.168.0.89" , 9667);
            $cl->SetMatchMode( SPH_MATCH_EXTENDED  );
            $cl->SetSortMode ( SPH_SORT_RELEVANCE );
            $cl->SetFieldWeights(array('post_title' => 300));
            $cl->SetLimits( $i , $limit);
            $q = $cl->EscapeString( $q);
    
            //search url only
            $q = $post_type ? "@post_type {$q}" : $q;
    
            $result = $cl->Query( $q, 'sites sitesDelta' );
    
            if ( $result === false )
                    error_log( '[SPHINX]Query failed: ' . $cl->GetLastError() );
            elseif ( $cl->GetLastWarning() )
                    error_log( '[SPHINX]WARNING: ' .  $cl->GetLastWarning() );
    
            if ( !empty($result["matches"]) ){
                foreach ( $result["matches"] as $doc => $docinfo )
                     $ids .= "$doc,";
                $ids = substr( $ids, 0, -1 );
           }else
               return false;
    
           return  array( 'ids' => $ids, 'total' => $result['total'], 'docs' => count($result["matches"])  );
    
    }
    
    /*
     * Connect to MySQL
     */
    function db(){
    
        if( !empty($GLOBALS['db']) ) return true;
    
        if( !$GLOBALS['db'] = mysql_connect('localhost', 'root', '' ) ) {
            die("[MYSQL]".mysql_error() . mysql_errno() );
        }
        elseif(!mysql_select_db('sphinxiirmulti')) {
            die("[MYSQL]".mysql_error() . mysql_errno() );
        }    
    
    }
    ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an input field that uses Autocomplete to show a list of possible
is that possible to show whole php page as an image file like png
Is that possible to have a single PHP SOAP server which will handle requests
I'd like to show a Dialog that occupies as much screen space as possible.
That's how cell selection looks in MS Excel: Is it possible to have the
Is that possible for spotlight search of iphone to take the contents of my
Is that possible with facebook api, to show the currently logged in facebook user's
I can't understand how is that possible, so i will just show the code.
i have a vb.net GUIform that will display an AxWebBrowser to show a html
In this post: Using of PhotoChooserTask I have found out that it is possible

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.