如何从数据库中获取PHP数组数组中的下一个值 [英] How do I get next value in PHP array array result from database
本文介绍了如何从数据库中获取PHP数组数组中的下一个值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
以下是我的代码,我想从结果数组中获取下一个cat_id和当前cat_id
foreach($ test_data as $ key)
{
$ current = $ key-> subcategory_id;
}
我的尝试:
foreach($ test_data as $ key)
{
$ current = $ key-> subcategory_id;
$ next = next($ key-> subcategory_id);
}
解决方案
test_data as
key)
{
电流=
Following is my code and i want to get next cat_id and current cat_id from the result array
foreach ($test_data as $key) { $current=$key->subcategory_id; }
What I have tried:
foreach ($test_data as $key) { $current=$key->subcategory_id; $next=next($key->subcategory_id); }
解决方案
test_data as
key) {
current=
这篇关于如何从数据库中获取PHP数组数组中的下一个值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文