1
回想我试图从单一的值或所有的值使用PHP的MySQL表中,它适用于单个值,并不是所有情况下值,请帮助我。无法返回一个值作为数组后,从MySQL使用PHP
function displaySitetype() {
$result = array();
$result = site_type_find("all");
print_r($result);
$count = count($result);
for ($iter = 0; $iter < $count; $iter++) {
?> <option value="<?php echo $iter; ?>"><?php echo $result[$iter]; ?></option> <?php }
}
function site_type_find($site_type) {
if ($site_type == "all") {
$result = mysql_query("select * from site_type_table");
$count = count($result);
while ($count) {
$resultarr = mysql_fetch_assoc($result);
$arr = array_push($arr, $resultarr['site_name']);
$count--;
} return $arr;
} else {
$result = mysql_query("select site_name from site_type_table where site_id=$site_type");
$arr = mysql_fetch_array($result);
return $arr[0];
}
}
错误我连续工作造成的错误太多了,谢谢您为我节省了很多挫折。 – Aravind 2013-04-09 12:15:46