예제 #1
0
<?php

include "../include/l2c.php";
include "../include/c2l.php";
include "konekcija.php";
header("Content-type: application/json; charset=utf-8");
if (!isset($_GET['query'])) {
    echo json_encode(1);
    exit;
}
$niz;
$vest = $_GET['query'];
$vest = l2c($vest);
$vest = $mysqli->real_escape_string($vest);
$sql = "SELECT vestid, vestnaslov FROM vesti WHERE vestnaslov LIKE '%{$vest}%'";
$q = $mysqli->query($sql);
while ($red = $q->fetch_object()) {
    $odgovor[] = array('vestid' => $red->vestid, 'vestnaslov' => c2l($red->vestnaslov));
}
echo json_encode($odgovor);
예제 #2
0
<?php

include "../include/l2c.php";
include "../include/c2l.php";
include "konekcija.php";
header("Content-type: application/json; charset=utf-8");
if (!isset($_GET['query'])) {
    echo json_encode(1);
    exit;
}
$niz;
$objava = $_GET['query'];
$objava = l2c($objava);
$objava = $mysqli->real_escape_string($objava);
$sql = "SELECT objid, objnaslov FROM objave WHERE objnaslov LIKE '%{$objava}%'";
$q = $mysqli->query($sql);
while ($red = $q->fetch_object()) {
    $odgovor[] = array('objid' => $red->objid, 'objnaslov' => c2l($red->objnaslov));
}
echo json_encode($odgovor);