$query = mysql_query( "SELECT * FROM adverts WHERE name LIKE '%".$_GET["search_string"]."%' LIMIT ".$_GET["StartWith"].", 200" );
while( $row = mysql_fetch_array( $query, MYSQL_ASSOC ) )
{
$row['id'] = $row['id'];
$row['name'] = $row['name'];
$row['text'] = $row['text'];
$row['price'] = $row['price'];
$row_set[] = $row;
}
echo json_encode($row_set);
$row_set = array();
$i = 0;
while( $row = mysql_fetch_array( $query, MYSQL_ASSOC ) )
{
$row_set[] = $row;
$i++;
}
echo json_encode($row_set), PHP_EOL, 'count: ', $i, PHP_EOL;