php求助,PHP问题求助,请大神帮忙。

//refresh function//refresh item statusfunction refresh(){$problem = false;$result = mysql_query("SELECT ITEM_ID FROM ITEM WHERE END > NOW() AND STATUS != 'SOLD'");if($result){while ($row = mysql_fetch_array($result)){$act_id = $row['ITEM_ID'];mysql_query("UPDATE ITEM SET STATUS = 'ACTIVE' WHERE ITEM_ID = $act_id");}$result = mysql_query("SELECT ITEM_ID, WINNER_ID, END FROM ITEM WHERE END <= 0="" 4="" 7="" now()="" and="" status="" !="SOLD" ");="" if($result)="" {="" while="" ($row="mysql_fetch_array($result))" $exp_id="$row['ITEM_ID'];" $win_id="$row['WINNER_ID'];" $time="$row['END'];" error="" here.="" there="" is="" only="" one="" row="" has="" been="" displayed.="" should="" be="" rows="" actully.="" result:="" 2013-04-14="" 00:00:00="" echo="" $exp_id."

";echo $win_id."

";echo $time."

";if($win_id == 0){mysql_query("UPDATE ITEM SET STATUS = 'EXPIRE' WHERE ITEM_ID = $exp_id");}else{mysql_query("UPDATE ITEM SET STATUS = 'SOLD' WHERE ITEM_ID = $exp_id");echo "INSERT INTO ITEM_SOLD VALUES($exp_id,$win_id,'".$time."','N')";mysql_query("INSERT INTO ITEM_SOLD VALUES($exp_id,$win_id,'".$time."','N')");}}$result = mysql_query("SELECT ITEM_ID FROM ITEM WHERE BEGIN > NOW() AND STATUS != 'SOLD'");if($result){while ($row = mysql_fetch_array($result)){$na_id = $row['ITEM_ID'];mysql_query("UPDATE ITEM SET STATUS = 'NA' WHERE ITEM_ID = $na_id");}}else{$problem = true;}}else{$problem = true;}}else{$problem = true;}if($problem){print '

Cannot refresh active item.';}}

Same query in phpMyadmin, but different result:

SQL query: SELECT ITEM_ID, WINNER_ID, END FROM ITEM WHERE END <= 30="" now()="" and="" status="" !="SOLD" limit="" 0,="" ;=""

Rows: 4

ITEM_ID WINNER_ID END

2 4 2013-04-14 00:00:00

4 2 2013-04-13 00:00:00

6 1 2013-04-14 00:00:00

7 0 2013-04-14 00:00:00

Anyone can help me to solve the problem? Thanks a lot!!!

回复讨论(解决方案)

mysql_fetch_array() 函数从结果集中取得一行作为关联数组,或数字数组,或二者兼有 on the line 21 of you code

mysql_fetch_array() 函数从结果集中取得一行作为关联数组,或数字数组,或二者兼有 on the line 21 of you code

I don’t quite understand… Any suggested solution?

(I don’t have chinese input software on this computer, sorry about that…)

i mean the function mysql_fetch_array() just return one row result

u use the funciton function mysql_fetch_array() in the code on 21 line has a error …

mysql_fetch_array ? Fetch a result row as an associative array, a numeric array, or both

u use the funciton function mysql_fetch_array() in the code on 21 line has a error …

mysql_fetch_array ? Fetch a result row as an associative array, a numeric array, or both

Thanks for taking time to answer my question. But I am new to php and mySQL, I cannot solve this myself.

Can you just simply give me a solution?

i mean the function mysql_fetch_array() just return one row result

I am so sorry!

Something is wrong in my database connection header file…

I choosed the wrong database. Now it is fixed.

i mean the function mysql_fetch_array() just return one row result

I am so sorry!

Something is wrong in my database connection header file…

I choosed the wrong database. Now it is fixed.

congratulation

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值