$name = mysql_num_rows($result);
$i = 0;
while($i < $name){
$nameAll = mysql_result($result, $i);
$i++;
}
答案 0 :(得分:1)
您可以使用第一个示例中的代码here。
$sql = "SELECT id as userid, fullname, userstatus
FROM sometable
WHERE userstatus = 1";
$result = mysql_query($sql);
// While a row of data exists, put that row in $row as an associative array
// Note: If you're expecting just one row, no need to use a loop
// Note: If you put extract($row); inside the following loop, you'll
// then create $userid, $fullname, and $userstatus
$values = array();
while ($row = mysql_fetch_assoc($result)) {
$values[] = $row["fullname"];
}