note 109777 added to sphinxclient.setserver
| From: | craig dot constable at gmail dot com | Date: | Mon, 20 Aug 2012 06:18:17 +0000 |
| Subject: | note 109777 added to sphinxclient.setserver | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-190138@lists.php.net to get a copy of this message | ||
<?php
//Here is an example of using the Sphinx api client
$server = "192.168.0.100:3306";
$username = "johnsmith";
$password = "Password1";
$database = "customers";
function newSQL() {
global $server, $username, $password, $database;
$con = new mysqli($server, $username, $password, $database);
return $con;
}
include('sphinxapi.php');
$search = '@postcode 2012';
$s = new SphinxClient;
$s->SetServer("192.168.0.100", 9312);
$s->SetMatchMode(SPH_MATCH_EXTENDED2);
$s->SetSortMode (SPH_SORT_EXTENDED,'@random');
$s->SetLimits(0, $times);
$index = 'main:delta';
$result = $s->Query($search, $index);
if ($result['total'] > 0) {
foreach ($result['matches'] as $id => $other) {
$people .= "pid=$id OR ";
}
$people = substr($people, 0, -4);
}
$mysqli = newSQL();
$mysqliResult = $mysqli->query("SELECT
pid, name,
postcode FROM profiles WHERE ($people)");
//Do something with $mysqliResult
$mysqli->close();
?>
----
Server IP: 69.147.83.197
Probable Submitter: 59.167.222.68
----
Manual Page -- http://www.php.net/manual/en/sphinxclient.setserver.php
Edit -- https://master.php.net/note/edit/109777
Del: integrated -- https://master.php.net/note/delete/109777/integrated
Del: useless -- https://master.php.net/note/delete/109777/useless
Del: bad code -- https://master.php.net/note/delete/109777/bad+code
Del: spam -- https://master.php.net/note/delete/109777/spam
Del: non-english -- https://master.php.net/note/delete/109777/non-english
Del: in docs -- https://master.php.net/note/delete/109777/in+docs
Del: other reasons-- https://master.php.net/note/delete/109777
Reject -- https://master.php.net/note/reject/109777
Search -- https://master.php.net/manage/user-notes.php