Php simple login script white page

后端 未结 1 1642
清歌不尽
清歌不尽 2021-01-29 05:30

Hello im trying to implant PDO into my login script to make it safrer from sql injection. But im getting a white page i think its because im trying to count the rows to see if

相关标签:
1条回答
  • 2021-01-29 06:03

    There's couple of things in your code that sticks in the eyeball.

    If you pasted the whole script here, you're missing session_start(). I don't know what's in your home.php, but if it's content generation depends on a value in $_SESSION['username'], it's never going to happen because it will be empty after the header redirection.

    Take a look at the manual about session_start().

    Also, as stated:

    For most databases, PDOStatement::rowCount() does not return the number of rows affected by a SELECT statement.

    Just in case thought to mention this. I've spent some good amount of time in the past wondering this thing myself.

    You might want to take a glance at example #2 on the manual about rowCount.

    And of course, as @Paul already pointed, you shouldn't be using mysql_query() anymore if migrating to PDO.

    0 讨论(0)
提交回复
热议问题