Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Tree: facccc3f47
Fetching contributors…

Cannot retrieve contributors at this time

14 lines (12 sloc) 0.432 kB
<?php
$text = $_GET['q']; // What the user has typed in.
$query = sprintf("SELECT id, name FROM activities " .
"WHERE name LIKE \"%s%%\";",
$text);
$result = mysql_query($query) or die(mysql_error());
$activities = array();
$pos = 0;
while ($row = mysql_fetch_assoc($result)) {
$activities[$pos++] = array('id' => (int)$row['id'], 'text' => $row['name']);
}
echo json_encode($activities);
Jump to Line
Something went wrong with that request. Please try again.