drq231358 2014-04-04 17:54
浏览 69

基本SQL / PHP(新手) - 获取特定“USER”的“ID”的语法是什么,即

The question is, I have an ID, username and a password for each user.

What is the syntax to get the ID based on a specific username and password.

I have this code but it doesn't seem to work :S

$dbusername=$row['user']; //php
$dbpassword=$row['password']; //php

$userID  = mysql_query("SELECT [$dbusername], [$dbpassword]' FROM users WHERE ID = $_GET[id]");

mysql_query("UPDATE users SET lastactivity = ".time()." WHERE ID = ".$userID);
  • 写回答

2条回答 默认 最新

  • dsj1961061 2014-04-04 18:00
    关注

    mysql_query doesn't return columns from the database. It returns a query object. You must then fetch rows from the database based on the query object. Please read the mysql documentation carefully. Better still, stop using mysql and use mysqli instead. http://php.net/manual/en/book.mysqli.php

    评论

报告相同问题?

悬赏问题

  • ¥40 复杂的限制性的商函数处理
  • ¥15 程序不包含适用于入口点的静态Main方法
  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码