gpt4 book ai didi

php - shop_item_id 必须有效

转载 作者:行者123 更新时间:2023-11-29 18:11:27 25 4
gpt4 key购买 nike

我正在使用这个基于 CodeIgniter 构建的头像社区引擎,除了商店系统之外,一切都正常。

每次我尝试购买商品时,我都会收到以下信息:

An Error Was Encountered

shop_item_id must be valid

我已将问题缩小到这段代码:

public function purchase_item()
{
$shop_item_id = $this->input->post('item_id');

if(!is_numeric($shop_item_id)) show_error('shop_item_id must be valid');

$shop_item_query = $this->db->join('avatar_items', 'avatar_items.item_id = shop_items.item_id')->get_where('shop_items', array('shop_item_id' => $shop_item_id));

if($shop_item_query->num_rows() > 0):
$shop_item_data = $shop_item_query->row_array();
else:
show_error('shop_item could not be found.');
endif;

$shop_id = $shop_item_data['shop_id'];

if ( ! $shop_data = $this->cache->get('shop_data_'.$shop_id)):
$shop_data = $this->db->get_where('shops', array('shop_id' => $shop_id))->row_array();
$this->cache->save('shop_data_'.$shop_id, $shop_data, 2400);
endif;

解决办法是什么?

p.s: 我正在使用crysandrea ( https://github.com/tylerdiaz/Crysandrea ) 的脚本。我的作业需要这个。

代码如下:

        <form action="/shops/purchase_item/" method="POST">
<input type="hidden" name="item_id" value="<?php echo $item_data['shop_item_id'] ?>" />
<button type="submit" class="main_button">Purchase item</button>
</form>

最佳答案

你忘记了分号。现在尝试以下代码

  <form action="/shops/purchase_item/" method="POST">
<input type="hidden" name="item_id" value="<?php echo $item_data['shop_item_id']; ?>" />
<button type="submit" class="main_button">Purchase item</button>
</form>

关于php - shop_item_id 必须有效,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47363532/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com