dongpin1059 2011-12-20 03:51
浏览 62
已采纳

在类中使用当前的mysql连接[关闭]

I'm trying to write a class that will fetch table columns and eval them as variables with the data in that column. I can't seem to get mysql_query() to work inside the class. Does it not work because mysql_query() is an outside function?

class the_info {
    function the_info() {
        $s = mysql_query("bla bla bla");
        while ($r = mysql_fetch_array($s)) {
            $out .= $r[0];
        }
    }
}

$f = new the_info();
echo $f->out;

Something like that. I know I didn't declare vars.

  • 写回答

1条回答 默认 最新

  • douboshan1466 2011-12-20 03:54
    关注

    mysql_query() is an inbuild PHP function, it has nothing to do with your custom classes. May be there might be problem with query that you are using. Paste some code !!

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

报告相同问题?

悬赏问题

  • ¥15 想问一下树莓派接上显示屏后出现如图所示画面,是什么问题导致的
  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥15 cmd cl 0x000007b
  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line
  • ¥500 火焰左右视图、视差(基于双目相机)
  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号