razo
Мастер
Дата регистрации:
22.04.2011 18:51:08
Сообщений: 176
через $_GET запрос
пример: aaa.com?uid=1,2,4,3,6
но не понятно в чем ошибка не выводит нечего, а смотрел вроде ошибок не нашел
$usid=$_GET['uid'];
$doc=new domDocument("1.0","utf-8"
$root=$doc->createElement("Profiles"
$explod=explode(",",$usid);
for($i=0;$i<count($explod);$i++){
$sql=mysql_fetch_row(mysql_query("SELECT * from `users` where `id`='$explod[$i]'");
$ph_sql=mysql_fetch_row(mysql_query("SELECT from `photos` where `myid`='$sql[0]'");
if(isset($ph_sql[0])){
$photo="http://aaa.com/".$ph_sql[1];
}
$sex=array(
"1"=>"M",
"2"=>"F"
);
$email=explode("@",$sql[5]);
$usr=$doc->createElement("user"
//uid//
$udi=$usr->createElement("uid"
$uid->appendChild($doc->createTextNode($sql[0]));
//first_name//
$name=$usr->createElement("first_name"
$name->appendChild($doc->createTextNode($sql[1]));
//last_name//
$last=$usr->createElement("last_name"
$last->appendChild($doc->createTextNode($sql[2]));
//nickname//
$nick=$usr->createElement("nickname"
$nick->appendChild($doc->createTextNode($sql[1]." ".$sql[2]));
//birthday//
$birth=$usr->createElement("birthday"
$birth->appendChild($doc->createTextNode(" ");
//sex//
$sex=$usr->createElement("sex"
$sex->appendChild($doc->createTextNode($sex[$sql[6]]));
//nkar//
$nkar=$usr->createElement("avatar_url"
$nkar->appendChild($doc->createTextNode($photo));
//country//
$count=$usr->createElement("country"
$count->appendChild($doc->createTextNode($sql[3]));
//city//
$city=$usr->createElement("city"
$city->appendChild($doc->createTextNode($sql[4]));
$root->appendChild($usr);
}
$doc->appendChild($root);
echo $doc->saveXML();
надо получить так
<profiles>
<user>
<uid>1</uid>
<first_name>aa</first_name>
<last_name>aa</last_name>
<nickname>aa</nickname>
<birthday></birthday>
<sex>M</sex>
<avatar_url>
http://aaa.com/aaa/1/photo805070396.jpg
</avatar_url>
<country>???????</country>
<city>asdasd</city>
</user>
<user>
<uid>2</uid>
<first_name>aa</first_name>
<last_name>aa</last_name>
<nickname>aa</nickname>
<birthday></birthday>
<sex>M</sex>
<avatar_url>
http://aaa.com/aaa/2/photo805070396.jpg
</avatar_url>
<country>???????</country>
<city>asdasd</city>
</user>
</profiles>