doubingqi5829 2012-07-05 03:20
浏览 100
已采纳

MySQL查询之间有什么区别

When I manually update a database in phpMyAdmin this is the code it uses:

UPDATE  `test`.`users` SET  `number` =  '12' WHERE  `users`.`id` =1;

This is the code I normally use in php when I write queries manually:

UPDATE `users` SET  `number` =  '12' WHERE `id` =1;

What is the difference? More importantly, which is better to use and why? Please answer the why, Thank You.

  • 写回答

3条回答 默认 最新

  • duanren9163 2012-07-05 03:22
    关注

    The one phpMyAdmin just includes the database name as well as the table name.

    In PHP, this is generally not needed, because you specify the database using mysqli_select_db or mysqli_connect.

    Both are equivalent; the only difference is the way the database is selected. In the first one, the database is specified explicitly in the query, in the second one, the database name is implied, since you specify it with mysqli_select_db or mysqli_connect.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 树莓派与pix飞控通信
  • ¥15 自动转发微信群信息到另外一个微信群
  • ¥15 outlook无法配置成功
  • ¥30 这是哪个作者做的宝宝起名网站
  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题