doudula1974 2014-01-04 18:13
浏览 59
已采纳

我怎么处理mysql_select_db中的$ db变量(“database”,$ db); [关闭]

What does the $db variable do and what can I do with it after writing it after the first parameter? I have searched for an answer but your answers are almost always better.

<?php 
    mysql_connect("localhost", "username", "password");
    mysql_select_db("database", $db);
?>

I ask this question because I see people using the $db tag a lot with representing the database. They do things like for example this: $db->query("SELECT * FROM questions") or die($db->error);.

  • 写回答

1条回答 默认 最新

  • drol55885602 2014-01-04 18:27
    关注

    $db is usually for database connection. It provides connection link to database, identifies the connection and provides database object. When you use mysql_* functions, you can define last parameter as connection variable. You use it to indentify connection, so multiple mysql connections don't mix up.

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

报告相同问题?

悬赏问题

  • ¥15 TLS1.2协议通信解密
  • ¥40 图书信息管理系统程序编写
  • ¥20 Qcustomplot缩小曲线形状问题
  • ¥15 企业资源规划ERP沙盘模拟
  • ¥15 树莓派控制机械臂传输命令报错,显示摄像头不存在
  • ¥15 前端echarts坐标轴问题
  • ¥15 ad5933的I2C
  • ¥15 请问RTX4060的笔记本电脑可以训练yolov5模型吗?
  • ¥15 数学建模求思路及代码
  • ¥50 silvaco GaN HEMT有栅极场板的击穿电压仿真问题