dongmiao520892
dongmiao520892
2012-09-29 05:40

使用带有会话数据的where子句的php登录表单

  • php
  • html
  • forms

I have created a login form that works, so the next step is to return data relative to the user that has logged in rather than the entire table. I am using a php session to parse the username from one file to another. I can echo this value without a problem, however when I try to use it in the following statement, unexpected T_STRING error is thrown. How do I parse the variable correctly.

$query = 'SELECT * FROM table WHERE table.username = $_SESSION['user']';
  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

5条回答

为你推荐