dongtuota3633 2012-09-25 19:30
浏览 42
已采纳

将mysql / php代码传输到PDO - 取代了mysql_close($ con)

I am doing a long poll and so I want to shut off my connection to the database on every loop (about 1 minute loops).

I used to use mysql_close($con), so what do I use in PDO?

Also, when I was using mysql_query it seemed to return numbers as string, so when I returned them to my calling js via json it was still a string. But now, the PDO seems to actually return it as a number. Is this right?

  • 写回答

2条回答 默认 最新

  • dream5694 2012-09-25 19:31
    关注
        $db = new PDO('mysql:host=localhost;dbname=test', $user, $pass);
         // use the connection here
         ...........
    
         // and now we're done; close it
          unset($db);
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 孟德尔随机化怎样画共定位分析图
  • ¥18 模拟电路问题解答有偿速度
  • ¥15 CST仿真别人的模型结果仿真结果S参数完全不对
  • ¥15 误删注册表文件致win10无法开启
  • ¥15 请问在阿里云服务器中怎么利用数据库制作网站
  • ¥60 ESP32怎么烧录自启动程序
  • ¥50 html2canvas超出滚动条不显示
  • ¥15 java业务性能问题求解(sql,业务设计相关)
  • ¥15 52810 尾椎c三个a 写蓝牙地址
  • ¥15 elmos524.33 eeprom的读写问题