<?php
$inname = $_GET['updatename'];
$inscore = $_GET['scores'];
$str="";
$coon = mysql_connect("127.0.0.1","root","snow") or die("无法连接mysql数据库服务器!");
$db = mysql_select_db("mygame") or die("无法连接数据库!");
$sql = "select scores from score order by scores DESC ";
$rst = mysql_query($sql) or die("无法执行sql语句:$sql !");
while ($row = mysql_fetch_array($rst)){
$dd=$row["scores"].",";$str .= $dd;
}
echo "&note=".$str;
?>

解决方案 »

  1.   

    $dd .= ($dd == "")?$row["scores"] :(",".$row["scores"]);
    }
    echo "&note=".$dd;//写在循环外
      

  2.   

    $tag = "";
    while($row = mysql_fetch_array($rst))
    {
      $dd .= $tag.$row["scores"];
      $tag = ",";
    }
    echo "&note=".$dd;
      

  3.   

    谢谢大家了,还有个小问题 出来的是 &not;e=100,80,75,67,55,50,48,32,25,
    我能不能让他变为 , &not;e=100,80,75,67,55,50,48,32,25  因为我读入flash里会把这个变成一个数组 进行比较。
      

  4.   

    $str=0
    while ($row = mysql_fetch_array($rst)){
    $dd=$row["scores"];
    if($str){
    $str .= ",".$dd;
    }else{
    $str = $dd;
    }
    }