-1

my Table's id İnformations 1 - 2 - 3 when ı try the run, i see last value. I want to see all values.

<?php
$host = "localhost";   //mysql adresi
    $user = "root";  //veritabanı kullanıcı adı
    $pass = "";  //veritabanı kullanıcı şifresi
    $database = "yemekcim";  //veritabanı adı
    $linkID = mysql_connect($host, $user, $pass) or die("Veritabanına bağlanılamadı.");  //bağlantı kuruluyor
    mysql_select_db($database, $linkID) or die("Veritabanı bulunamadı.");
     $query="select * from mekan_menu_icerik";
    $resultID = mysql_query($query, $linkID) or die("Veri bulunamadı.");

    while($data = mysql_fetch_assoc($resultID)) {

     $newsXML = new SimpleXMLElement("<firmabilgi></firmabilgi>");
$newsXML->addAttribute('newsPagePrefix', $data["id"]);
$newsIntro = $newsXML->addChild('content');
$newsIntro->addAttribute('type', 'latest'); 

    }
Header('Content-type: text/xml');
echo $newsXML->asXML();

?>

1 Answers1

0

You are echoing only the last value, because you have put the actual 'echo' out of the while statement.

To display all of them you should do the echo inside the while, right after the call to addAttribute().

the_escapist
  • 50
  • 2
  • 8