Проблемы с аяксом

N
На сайте с 14.06.2004
Offline
107
469

Создаю связанные селекты. При ввыборе из одного елемента обрабатывается так выбор:

onchange='xajax_getList2(this.options[this.selectedIndex].value, "country")'

функция getList2

function getList2($region, $flag) 

{
if($flag=='country')
{
$text = "<option value='0'>-Выберите регион-</option>";
$sql="select * from regions where parent_country=$region and parent_region=0";
$res=mysql_query($sql);
while ($row = mysql_fetch_array($res))
{
$text .= "<option value='".$row['id']."'>".$row['country']."</option>";
}
$text = "<select name='region' class=\"inputtext\" onchange='xajax_getList2(this.options[this.selectedIndex].value, \"city\")'>$text</select>";
$objResponse = new xajaxResponse();
$objResponse->setCharEncoding('windows-1251');
$objResponse->addAssign("div2", "innerHTML", $text);
return $objResponse;
}

Ругается на sql-запрос :

--------------------------------------------------------------------------------

Error: The XML-Response that was returned from the server is invalid. Received:
select * from regions where parent_country=1 and parent_region=0

--------------------------------------------------------------------------------

Выпаолняю этот запрос через пхпмайадмин - все норм. Выборку делает. Почему тогда ругается на запрос?

Авторизуйтесь или зарегистрируйтесь, чтобы оставить комментарий