$result = mysql_query("SELECT * FROM project ORDER BY projectid");
while($row = mysql_fetch_array($result))
{
return(array($row['projectid'], $row['clientname'],
$row['salesperson'], $row['prospect']));
}
I get only the first set of values from the fields. I need all the values.
我只从字段中获得第一组值。我需要所有的价值观。
1 个解决方案
#1
You can only return once from a function. Build an array of results and return that:
您只能从函数返回一次。构建一个结果数组并返回:
$result = mysql_query("SELECT * FROM project ORDER BY projectid");
$values = array();
while($row = mysql_fetch_array($result))
{
$values[] = array($row['projectid'], $row['clientname'], $row['salesperson'], $row['prospect']);
}
return $values;
#1
You can only return once from a function. Build an array of results and return that:
您只能从函数返回一次。构建一个结果数组并返回:
$result = mysql_query("SELECT * FROM project ORDER BY projectid");
$values = array();
while($row = mysql_fetch_array($result))
{
$values[] = array($row['projectid'], $row['clientname'], $row['salesperson'], $row['prospect']);
}
return $values;