Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/286.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/arrays/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
php codeigniter框架中的数组_Php_Arrays_Codeigniter - Fatal编程技术网

php codeigniter框架中的数组

php codeigniter框架中的数组,php,arrays,codeigniter,Php,Arrays,Codeigniter,我遇到了数组顺序问题,来自数据库的数组是正确的,但是每次我刷新页面时,数组的顺序都会改变 Array ( [0] => stdClass Object ( [prodtmappid] => 53624 [totalrating] => 5.00 [SKUNO] => C46P53624R7621 [ProId] => 31369 [CatId] => 4

我遇到了数组顺序问题,来自数据库的数组是正确的,但是每次我刷新页面时,数组的顺序都会改变

Array ( [0] => stdClass Object ( [prodtmappid] => 53624 [totalrating] => 5.00 [SKUNO] => C46P53624R7621 [ProId] => 31369 [CatId] => 46 [proQnty] => 15 [productMRP] => 1299 [ProDisPrice] => 0 [SellingPrice] => 390 [AdditionDiscount] => 0 [FinalPrice] => 390 [ProDiscount] => 70 [ProDisType] => percentage [ProName] => Trendy Bandey Men TB20 Yellow Tshirt [TotalValues] => 0.00 [image] => MCTSTB-TB20-YL_1_55x_885.JPG [BrandId] => 4233 [FDisId] => 7 [ColorID] => 191 [size_Val] => M ) [1] => stdClass Object ( [prodtmappid] => 9526 [totalrating] => 0.00 [SKUNO] => C46P9526R1870 [ProId] => 3351 [CatId] => 46 [proQnty] => 8 [productMRP] => 1899 [ProDisPrice] => 0 [SellingPrice] => 1329 [AdditionDiscount] => 0 [FinalPrice] => 1329 [ProDiscount] => 30 [ProDisType] => percentage [ProName] => FCUK 56DPJ Pink Men T-Shirt [TotalValues] => 0.00 [image] => FCUK2_1_28x_885.JPG [BrandId] => 1285 [FDisId] => 4 [ColorID] => 194 [size_Val] => S ) 排列 ( [0]=>stdClass对象 ( [prodtmappid]=>53624 [totalrating]=>5.00 [SKUNO]=>C46P53624R7621 [ProId]=>31369 [CatId]=>46 [proQnty]=>15 [productMRP]=>1299 [ProDisPrice]=>0 [销售价格]=>390 [附加折扣]=>0 [最终价格]=>390 [ProDiscount]=>70 [ProDisType]=>百分比 [ProName]=>时尚班迪男式TB20黄色T恤 [总值]=>0.00 [图片]=>MCTSTB-TB20-YL_1_55x_885.JPG [BrandId]=>4233 [FDisId]=>7 [ColorID]=>191 [size_Val]=>M ) [1] =>stdClass对象 ( [prodtmappid]=>9526 [totalrating]=>0.00 [SKUNO]=>C46P9526R1870 [ProId]=>3351 [CatId]=>46 [proQnty]=>8 [productMRP]=>1899 [ProDisPrice]=>0 [销售价格]=>1329 [附加折扣]=>0 [最终价格]=>1329 [ProDiscount]=>30 [ProDisType]=>百分比 [ProName]=>FCUK 56DPJ粉色男士T恤 [总值]=>0.00 [图片]=>FCUK2_1_28x_885.JPG [BrandId]=>1285 [FDisId]=>4 [ColorID]=>194 [size_Val]=>S )
所以我面临的问题是数组[0]['prodtmappid']将在每个页面引用上有不同的值。

您的查询是什么?从结果来看,它看起来像是
按prodQnty DESC排序
按catId分组
。如果您想保持结果一致,请将
按prodtmappid排序
添加到您的查询中。

您的查询是什么,是否使用“rand()“在查询中”数组值在每个refresmay上都应该是相同的,同时也可以访问数据库,这就是id随时间而变化的原因。请按prodtmappid添加一个
ORDER
query@Deepesh我已经检查了链接,问题就在那里,但我想检查查询。有什么方法可以打印您的查询吗?