How does search.php works for this .. Can I have whole project demo as zip.. Thanks!!

Hawkee  -  Feb 14, 2013

There is a link to the GitHub project, but that only contains this core jQuery widget. You'll need to implement your own search.php or you can look at my node.js server side example.

sud_mrjn  -  Feb 15, 2013

My search.php is like this
<?php

//connection information
$host = "localhost";
$user = "root";
$password = "";
$database = "mention_list";
$param = $_GET["term"];

//make connection
$server = mysql_connect($host, $user, $password);
$connection = mysql_select_db($database, $server);

//query the database
$query = mysql_query("SELECT * FROM friends WHERE name REGEXP '^$param'");

//build array of results
for ($x = 0, $numrows = mysql_num_rows($query); $x < $numrows; $x++) {
    $row = mysql_fetch_assoc($query);

    $friends[$x] = array("name" => $row["name"]);       
}

//echo JSON to page

echo json_encode($friends);
mysql_close($server);

?>

But your widget also include trigger with search word eg. @cobol

Hawkee  -  Feb 17, 2013

Make sure you set the value and label fields before you do json_encode. You aren't creating your associative array correctly. It should be something like this:

$user['value'] = $row['user_id'];
$user['label'] = $row['name'];
$friends[] = $user;
Sign in to comment

Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.