如何将查询结果分配给数组元素?PHP:将查询结果插入数组元素
这是我的代码:
include('db.php');
$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die("Database connection error");
mysql_select_db($dbname);
$query = "select * from test where value=20";
$result = mysql_query($query);
$vegetable_list = array('$rice', '$wheat', '$potato', '$pulses');
$i = 1;
while($row_result = mysql_fetch_row($result))
{
??????? = $row_result[$i];
$i++;
}
我怎么可以指定查询结果到数组?假设:
$rice = $row_result[1];
$wheat = $row_result[2];
$potato = $row_result[3];
如何自动分配值?
想如果这事做了_farm game_? – 2010-10-05 06:43:09