在下面的示例中,我将ID的数组仅用于将其变成一段时间,然后返回到数组中,仅用于使页面上的逗号发生爆炸。当然,必须有一个更简单的方法来做到这一点。PHP mySQL查询删除双数组
我是$行[ 'ID']组成的数组后
function get_other_elector_phone($telephone,$current,$criteria){
$the_others = mysql_query("SELECT * FROM electors WHERE telephone = '$telephone' $criteria"); $results = '';
while($row = mysql_fetch_array($the_others)) {
$results .= $row['ID'].','; } return $results;
}
$others = get_other_elector_phone(g('electors',$elector,'telephone'),$elector,$criteria);
if($others){ $others = explode(',',$others);
只是...建立并返回一个数组而不是一个字符串? – DaveRandom