doutou1922 2013-03-10 16:10
浏览 99
已采纳

Mysql在php变量中得到UPDATE-SET的结果

I have following mysql statement, is there a simple way to access result_value? I want to get the value that has been set in the current statement outside of query in php variable. Should I do mysql fetch array?

UPDATE results
SET result_value = IF('$logo_value' - result_tries < 0 OR '$logo_value' - result_tries = 0, 1, '$logo_value' - result_tries)
WHERE logo_id = '$logo_id'
AND user_id = '$user_id'
AND result_value = 0"
  • 写回答

1条回答 默认 最新

  • douci6541 2013-03-10 16:15
    关注

    Fetch work only with "SELECT" query, other statements do not return rows. You can get this value by SELECTing it before eg.

    SELECT IF('$logo_value' - result_tries < 0 OR '$logo_value' - result_tries = 0, 1, '$logo_value' - result_tries) AS result_value;
    

    (or after if it is inserted)

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 maixpy训练模型,模型训练好了以后,开发板通电会报错,不知道是什么问题
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 有没有帮写代码做实验仿真的
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥30 vmware exsi重置后登不上
  • ¥15 c++头文件不能识别CDialog
  • ¥15 Excel发现不可读取的内容