PHP对循环的结果进⾏排序并在屏幕上显⽰
I was wondering if someone could point me in the right direction with a coding issue Im having.
I am running a while loop in PHP comparing a post code to another and each run of the loop generates distance data. What Id like to do is t hen sort this data and display it.
php如何运行代码Usually I'd throw everything into a MySQL database then sort that way but I think thats over kill.
Here's an example of the loop :
while($row = mysql_fetch_array($result))
{
$info = get_driving_information($_POST['customerpostcode'], $row[instructor_postcode]);
echo $row['instructor_name'] . " - " . $info['distance'];
}
I know this is probably PHP 101 but Ive never had to do anything like this before and am not sure how.
Thanks in advance for reading,
Rik
图⽚转代码服务由CSDN问答提供功能建议
我想知道是否有⼈可以指出我正确的⽅向,我有编码问题。
\ n
我在PHP中运⾏while循环,将后置代码与另⼀个循环代码进⾏⽐较,并且循环的每次运⾏都会⽣成距离数据。我喜欢做的就是对这些数据进⾏排序并显⽰出来。
通常我会将所有内容都放⼊MySQL数据库中,然后按照这种⽅式进⾏排序,但我认为这会过度杀戮。
以下是循环的⽰例:
while($ row = mysql_fetch_array($ result))
{
$ info = get_driving_information ($ _POST ['customerpostcode'],$ row [instructor_postcode]);
echo $ row ['instructor_name']。 “ - ”。 $信息[ '距离'];
}
我知道这可能是PHP 101但我以前从未做过这样的事情⽽且不确定如何。
\ n
提前感谢您的阅读,
Rik
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论