ambil tutorial di
http://loopj.com/jquery-tokeninput/
kodenya
$pb = $_POST[pb];
echo $pb;
$apb = explode(",",$pb);
print_r($apb);
?>
dan
session_start();
include "db.php";
include "lib/fungsi.php";
$query = sprintf("SELECT id, CONCAT(pbName, ' ',phoneNumber) as name from phonebook WHERE pbName LIKE '%%%s%%' ORDER BY id DESC LIMIT 10", mysql_real_escape_string($_GET["q"]));
$arr = array();
$rs = mysql_query($query);
# Collect the results
while($obj = mysql_fetch_object($rs)) {
$arr[] = $obj;
}
# JSON-encode the response
$json_response = json_encode($arr);
# Optionally: Wrap the response in a callback function for JSONP cross-domain support
if($_GET["callback"]) {
$json_response = $_GET["callback"] . "(" . $json_response . ")";
}
# Return the response
echo $json_response;
?>
http://loopj.com/jquery-tokeninput/
kodenya
$pb = $_POST[pb];
echo $pb;
$apb = explode(",",$pb);
print_r($apb);
?>
No Duplicates
dan
session_start();
include "db.php";
include "lib/fungsi.php";
$query = sprintf("SELECT id, CONCAT(pbName, ' ',phoneNumber) as name from phonebook WHERE pbName LIKE '%%%s%%' ORDER BY id DESC LIMIT 10", mysql_real_escape_string($_GET["q"]));
$arr = array();
$rs = mysql_query($query);
# Collect the results
while($obj = mysql_fetch_object($rs)) {
$arr[] = $obj;
}
# JSON-encode the response
$json_response = json_encode($arr);
# Optionally: Wrap the response in a callback function for JSONP cross-domain support
if($_GET["callback"]) {
$json_response = $_GET["callback"] . "(" . $json_response . ")";
}
# Return the response
echo $json_response;
?>
Komentar