我正在运行带有while循环的查询,该查询创建了列名称的数组
while($ContactLookup_Row = mysql_fetch_array($ContactLookup_Rs)) {
$ContactLookup_Results[] = array(
'sequence'=>$ContactLookup_Row["sequence"],
'forename'=>$ContactLookup_Row["forename"],
'surname'=>$ContactLookup_Row["surname"]
);
}
如何使循环将所有列名添加为自己的变量,而不必手动将其全部键入?
我应该放在$ContactsLookup_Results[]= array(
while循环之前。然后);
在while循环之后
然后我不确定是否在循环中?
我希望它看起来像:
'ColumnName'=>$ContactLookup_Row["ColumnName"]
在每个结尾处使用,而不是最后一个
怎么样
while($ContactLookup_Row = mysql_fetch_array($ContactLookup_Rs)) {
$ContactLookup_Results[] = $ContactLookup_Row;
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句